Identify the correct order in which a server process must invoke the function calls accept , bind , listen , and recv according to UNIX socket API.
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2015 Set 2 · Q20
Time
accept, bind, listen, and recv according to UNIX socket API.Select one answerSingle correct
Solution
Official answer: B) bind, listen, accept, recv
TCP Flow and Congestion ControlIn a standard TCP connection using the UNIX socket API, the server process follows these steps:
socket() creates an endpoint for communication.
bind() assigns a local protocol address (IP address and port) to the socket.
listen() marks the socket as passive, indicating that it will be used to accept incoming connection requests, and specifies a backlog queue.
accept() extracts the first connection request on the queue of pending connections and creates a new connected socket.
recv() reads data received from the client over the established connection.
Therefore, the correct invocation sequence is bind, listen, accept, recv, which corresponds to option (B).
Try the question first, then check your work.
Examiner trap
The server must first associate an address with its socket, then prepare to queue connections, then wait to take a client off the queue, and finally receive data.
This TCP Flow and Congestion Control previous year question is Q20 of the GATE CSE 2015 Set 2 paper. Find more GATE CSE PYQs on TCP Flow and Congestion Control in Computer Networks, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related TCP Flow and Congestion Control PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
TCP Flow and Congestion Control has 23 GATE CSE PYQs across 21 papers from 2012 to 2026. 10 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2015 Set 2.
How GATE tests TCP Flow and Congestion ControlIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.