1 Answers
Option 4 : FIN-WAIT-2
After completing the data transfer, the TCP client executes a close primitive, and a FIN segment is sent to the TCP server by the client and wait for the corresponding ACK from the server. After this, two cases will happen:
1) When the ACK arrives from the server, a transition is made to state FIN-WAIT 2 by the client and then one direction of the connection will be closed. When other side closes too, a FIN comes in which is acknowledged and both sides will be closed.
2) In second case, instead of getting ACK from server till the time-out, TCP client received FIN from server. Client will acknowledge this FIN and then it will move to the close state. TCP client will wait for the ACK for its own FIN from server. After receiving ACK, TCP client will move to the TIME-WAIT state.
Diagram: