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 , in which state does the client-side TCP connection wait for the FIN from the server-side TCP?
View worked solution
Answer: D
To determine the correct state, let's trace the TCP connection termination states for the active closer (the client):
- ESTABLISHED → FIN-WAIT-1: The client application calls
close(), which prompts the client-side TCP to send aFINsegment to the server. The client transitions to the FIN-WAIT-1 state. - FIN-WAIT-1 → FIN-WAIT-2: The client waits in FIN-WAIT-1 for an acknowledgment (
ACK) of itsFINsegment. Once thisACKis received, the client transitions to the FIN-WAIT-2 state. - FIN-WAIT-2 → TIME-WAIT: While in the FIN-WAIT-2 state, the client-side TCP waits for the
FINsegment from the server-side TCP (which indicates that the server has also finished sending data and is closing). Upon receiving thisFIN, the client sends anACKand transitions to the TIME-WAIT state.
Thus, the state in which the client-side TCP waits for the FIN from the server-side TCP is FIN-WAIT-2.
Free practice · Your answers on this page are not saved.
