TCP goes through multiple state in its lifetime, those states are:
CLOSED: This is the state of the client and server, when none of them have initiated the connection that is no connection at all.
LISTEN: This is the state of the server(passive) and is awaiting for the connection request(SYN) from the client side.
This state represent that connection initiation(SYN) is sent and is waiting for the matching connection request from other end.
SYN-RECEIVED: This state represent that waiting for an acknowledgement once SYN has been sent and also received.
ESTABLISHED: This state represent that connection is established and data can be transmitted.
FIN_WAIT-1: This state represent waiting for the acknowledgement of the previously sent FIN request or waiting for the connection termination(FIN) from the other end.
This state is reached when the ACK is received for the FIN request sent previously. So this is like one way connection is terminated and that entity will not send any further data except for the ACK for the FIN from other end.
This state is reached when the client does not receive ACK for its FIN request sent rather it also receives FIN from other end. So in this state client is waiting for the ACK for the FIN request sent.
Its like both the parties simultaneously send the FIN request.
This state comes once the end point has received FIN and send ACK for it and is waiting for request to terminate connection locally. Means now the entity has to send FIN and is waiting to do so.
This state represents that it is waiting for the last ACK to reached to the other end point, sent in response of its FIN request.
Once the end point sends the FIN, it goes into LAST-ACK that is waiting for the last ACK to receive from the client side.
Leave a Reply