CS FundamentalsHardGATE CS · Product company CS fundamentals
A UDP server and a TCP server are written with BSD sockets. Which statement is correct?
- A. Both servers call listen() and accept() before receiving data
- B. Only the UDP server needs bind(); a TCP server gets a port from accept()
- C. Only the TCP server calls listen() and accept(); the UDP server binds and calls recvfrom()
- D. The TCP server calls connect() to wait for clients
Correct answer: C. Only the TCP server calls listen() and accept(); the UDP server binds and calls recvfrom()
listen() turns a TCP socket into a passive one and accept() returns a new connected socket per client. UDP is connectionless: after bind() to a port the server reads datagrams with recvfrom(), learning each sender's address from it. connect() is the client's call.
More Computer Networks questions
- What is the maximum size of the options area in a TCP header?
- An attacker floods a server with SYNs from spoofed addresses and never completes the handshake. Which defence lets the server keep NO…
- Which statement about firewalls is correct?
- 192.168.0.0/16 is divided into /26 subnets. In how many of these subnets is an address ending in .255 the BROADCAST address, and in how…
- A host with address 172.16.5.10/23 wants to reach 172.16.4.200. What does it do?
- A TCP connection runs over a 100 Mbps path with one-way propagation delay 10 ms. The window is fixed at 64 KB (65,536 bytes) and segments…