Question
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?
Official answer and solution
- Official answer
- D
- From
- Official GATE 2017 answer key
Solution
Follow the TCP finite state machine transitions according to RFC 793 during active connection close.
According to the TCP connection state machine (RFC 793), the active close sequence proceeds as follows:
- The client application calls
close(). The client TCP sends a FIN control segment to the server and enters theFIN-WAIT-1state. - The server TCP receives the FIN and sends back an ACK segment (and moves to
CLOSE-WAIT). - Upon receiving this ACK for its FIN, the client TCP transitions from
FIN-WAIT-1toFIN-WAIT-2.
In the FIN-WAIT-2 state, the client connection has closed its half of the connection (cannot send more data) and is waiting to receive the FIN segment from the server.
4. When the server eventually sends its FIN, the client receives it, replies with an ACK, and transitions to the TIME-WAIT state.
Therefore, the client waits for the FIN from the server in the FIN-WAIT-2 state.
D
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2017 Computer Science and Information Technology (CS) Session 1
- Question
- 14 of 65, printed as CS Q.14
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.