Open In App

GATE | GATE-CS-2017 (Set 1) | Question 12

Like Article
Like
Save
Share
Report

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?
(A) LAST-ACK
(B) TIME-WAIT
(C) FIN-WAIT-1
(D) FIN-WAIT-2


Answer: (D)

Explanation: Client has sent FIN segment to the server and moves to FIN-WAIT-1, i.e. waiting for the ACK for own
FIN segment. There are two possibilities here :

  1. If Client receives ACK for its FIN then client will move to FIN-WAIT-2 and will wait for matching
    FIN from server side. After receiving the FIN from server, client will send ACK and move to TIME-WAIT
    state.
  2. Client has sent FIN segment but didn’t get ACK till the time. Instead of ACK, client received FIN
    from server side. Client will acknowledge this FIN and move to CLOSE state. Here Client will wait for
    the ACK for its own FIN. After receiving ACK, client will move to TIME-WAIT state.
    Here we encounter First Case.
  3. So, the solution is (D).


    Quiz of this Question


    Last Updated : 15 Feb, 2018
    Like Article
    Save Article
    Previous
    Next
    Share your thoughts in the comments
Similar Reads