Skip to content

GATE CS 2014 Set 2 Q24 — Transport Layer: Flow Control, Congestion Control, UDP, TCP, Sockets

Explain with AI

Which of the following socket API functions converts an unconnected active TCP socket into a passive socket?

Choose one option
View worked solution

Answer: C

In TCP socket programming, a newly created socket (via the socket() system call) is an active socket by default, meaning it can be used to initiate an outgoing connection.

To set up a server, this active socket must be converted into a passive socket that listens for incoming connection requests from clients.

  • listen(): This system call converts an unconnected active socket into a passive socket, instructing the kernel to accept incoming connection requests directed to this socket. It also specifies the backlog queue limit for pending connections.
  • connect(): Used by a client to initiate a connection to a server's passive socket.
  • bind(): Associates a local IP address and port number with the socket.
  • accept(): Blocks the server process until a connection request arrives, returning a new active socket dedicated to that specific client connection.

Therefore, the function that converts an unconnected active TCP socket into a passive socket is listen.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Transport Layer: Flow Control, Congestion Control, UDP, TCP, Sockets questions