Computer-Networks
August 29, 2024
Computer-Networks
August 29, 2024
Computer-Networks
August 29, 2024
Computer-Networks
August 29, 2024

Computer-Networks

Question 315
Identify the correct order in which a server process must invoke the function calls accept, bind,
listen and recv according to UNIX socket API.
A
listen, accept, bind, recv
B
bind, listen, accept, recv
C
bind, accept, listen, recv
D
accept, listen, bind, recv
Question 315 Explanation: 
The correct order in which a server process must invoke the function calls according to UNIX socket API is
socket() creates a new socket of a certain type, identified by an integer number, and allocates system resources to it.
bind() associates a socket with a socket address structure, i.e. a specified local IP address and a port number.
listen() causes a bound TCP socket to enter listening state.
accept() accepts a received incoming attempt to create a new TCP connection from the remote client, and creates a new socket associated with the socket address pair of this connection.
send(), recv(), sendto(), and recvfrom() are used for sending and receiving data.
Correct Answer: B
Question 315 Explanation: 
The correct order in which a server process must invoke the function calls according to UNIX socket API is
socket() creates a new socket of a certain type, identified by an integer number, and allocates system resources to it.
bind() associates a socket with a socket address structure, i.e. a specified local IP address and a port number.
listen() causes a bound TCP socket to enter listening state.
accept() accepts a received incoming attempt to create a new TCP connection from the remote client, and creates a new socket associated with the socket address pair of this connection.
send(), recv(), sendto(), and recvfrom() are used for sending and receiving data.

Leave a Reply

Your email address will not be published. Required fields are marked *