GATE / CS ARCHIVE

GATE CSE 2015 SET 2 / QUESTION 33

GATE CSE 2015 Set 2 Q33

Computer Networks · Transport, Congestion Control & Traffic Shaping · Full GATE CSE 2015 Set 2 paper

GATE 2015 Set 2, Q33 1 mark · MCQ
Report issue

Transport, Congestion Control & Traffic Shaping

Question 33, GATE 2015: Order UNIX listening-server calls: A listen, accept, bind, recv; B bind, listen, accept, recv; C bind, accept, listen, recv; D accept, listen, bind, recv.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

A listening server binds its local address, listens for connections, accepts one, then receives on the accepted connected socket. Thus bind, listen, accept, recv, B.

Binding associates the socket with its local address/port. Listening converts it into a passive connection endpoint. Accept waits for and returns a connected socket for one client. Receive then reads data on that connected socket. Calling accept before listen or before binding a specified listening address does not implement the requested server sequence. The original listening socket and the accepted connection socket have different roles.

Original paper, page 37 · Answer key