In tcp what is a 4 way close?

author
  • Total 1 Answer
  • 6842
Can You answer this question?
author

Hi Kumar,

When a client and server shutdown gracefully then TCP uses 4 way Close to terminate a TCP Stream. So it works like this Client will Send the FIN Bit in TCP header and It Will Wait for FIN from Server as well and ACK in the response of its own FIN This stage is Called FIN wait-1 Stage.

Now the Following event Will Occur.

NO. 1-If the client gets the ACK for His FIN he will move to FIN-Wait-2 Stage.

NO.2-If the client Receive FIN he Will Send ACK in He will move to the Closing stage.

NO.3-If in FIN-Wait 2 Client Receive the FIN from the server he will reply with ACK and happily move to Time-wait(This is where you Connection is close but in Background, but they wait for some timer expire called time-wait).

NO.4-If in Closing Stage Client receives  ACK for his FIN he will move to Time-wait again.

NO.5- If that Timer hit zero they will close the Stream.

P.S. Client will send FIN and Server Will Acknowledge it With ACK and Server Will also send FIN and client will Acknowledge it with its own ACK. Four Way.

 

 

Hope that will Help......

Thanks