CS FundamentalsModerateProduct-company placement · TCS NQT

A TCP server listens on port 80. Three clients connect and the server accept()s all of them. How many TCP sockets does the server process now hold, and what local port do the connected ones use?

  1. A. 4 sockets, all with local port 80
  2. B. 3 sockets, each on a new ephemeral port
  3. C. 4 sockets: the listener on 80, the others on ephemeral ports
  4. D. 1 socket on port 80 shared by all three connections

Correct answer: A. 4 sockets, all with local port 80

accept() returns a new connected socket for each client while the listening socket stays open, so there are 1 + 3 = 4. Connected sockets keep local port 80; they are told apart by the full 4-tuple (local IP, local port, remote IP, remote port).

More Computer Networks questions

Exams that ask this topic