Server / Client commands Flashcards

1
Q

What does socket() do?

A

Creates a socket (an endpoint for communication).
This is for both server and client

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does bind() do?

A

Associates the socket with an IP address and port number.
Only for server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does listen() do?

A

Marks the socket as passive, ready to accept incoming connections.
Only for server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does accept() do?

A

Accepts an incoming connection and creates a new socket for communication.
Only for server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does close() do?

A

Closes the socket, releasing its resources.
for both server and client

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does connect() do?

A

Connects the client socket to the server’s address. (can read/write after connecting)
only for client

How well did you know this?
1
Not at all
2
3
4
5
Perfectly