The GATE Grind

GATE 2015 CS (CS2) – Question 33

Computer Networks · TCP: Flow Control, Congestion Control, Socket API · 1 mark · Multiple choice

In which order does a UNIX socket server invoke accept, bind, listen and recv?

  1. listen,accept,bind,recv
  2. bind,listen,accept,recv
  3. bind,accept,listen,recv
  4. accept,listen,bind,recv

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (B) bind,listen,accept,recv

Explanation

First bind assigns the local address. Listen marks the socket as passive and establishes its connection queue. Accept obtains a connected socket from that queue; recv then reads application data on it. Therefore B is the valid order.

More TCP: Flow Control, Congestion Control, Socket API questions

All TCP: Flow Control, Congestion Control, Socket API questions →