Consider a TCP client and a TCP server running on two different machines.…

2017

Consider a TCP client and a TCP server running on two different machines. After completing data transfer, the TCP client calls close to terminate the connection and a FIN segment is sent to the TCP server. Server-side TCP responds by sending an ACK, which is received by the client-side TCP. As per the TCP connection state diagram (RFC 793), in which state does the client-side TCP connection wait for the FIN from the server-side TCP?

  1. A.

    LAST-ACK

  2. B.

    TIME-WAIT

  3. C.

    FIN-WAIT-1

  4. D.

    FIN-WAIT-2

Attempted by 107 students.

Show answer & explanation

Correct answer: D

Answer: FIN-WAIT-2 — after the client performs an active close and its FIN is acknowledged, it enters FIN-WAIT-2 and waits for the server's FIN.

Step-by-step sequence (active close by client):

  1. Client calls close and sends a FIN to the server.

  2. After sending the FIN the client is in FIN-WAIT-1 while waiting for an ACK of its FIN.

  3. When the client receives the ACK for its FIN, it transitions to FIN-WAIT-2 and now waits for the FIN from the server (this is the state asked about).

  4. When the server sends its FIN and the client sends the final ACK, the client enters TIME-WAIT to wait for 2×MSL before fully closing the connection.

Clarifying common states:

  • FIN-WAIT-1: After sending FIN, waiting for ACK of that FIN (or a simultaneous FIN).

  • FIN-WAIT-2: After the client's FIN is acknowledged; waiting for the remote FIN (this is the answer).

  • LAST-ACK: The state of an endpoint that has received a FIN, sent its own FIN in reply, and is waiting for the final ACK.

  • TIME-WAIT: Entered after sending the final ACK in response to the remote FIN; the endpoint waits for 2×MSL before fully closing.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir