GATE : Computer Science and IT

Identify the correct order in which a server process must invoke the function calls accept, bind, listen, and recv according to UNIX socket API. , Identify the correct order in which a server process must invoke the function calls accept, bind, listen, and recv according to UNIX socket API.

Identify the correct order in which a server process must invoke the function calls accept, bind, listen, and recv according to UNIX socket API.




Solution
B. bind, listen, accept, recv



Explanation

 bind, listen, accept and recv are server side socket API functions.
bind() associates a socket with a socket address structure,
i.e. a specified local port number and IP address.
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,
recv() is used to receive data from a remote socket.
A server must first do bind() to tell operating system the port number on which it would be listing, then it must listen to receive incoming connection requests on the bound port number. Once a connection comes, the server accepts using accept(), then starts receiving data using recv().

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Exam Quiz Website development Company in Allahabad