Client | Server | ||||
Start State | Action | Transitions To State | Start State | Action | Transitions To State |
ESTABLISHED | Client Close Step #1 Transmit: The application using TCP signals that the connection is no longer needed. The client TCP sends a segment with the FIN bit set to request that the connection be closed. | FIN-WAIT-1 | ESTABLISHED | At this stage the server is still in normal operating mode. | — |
FIN-WAIT-1 | The client, having sent a FIN, is waiting for it to both be acknowledged and for the serve to send its own FIN. In this state the client can still receive data from the server but will no longer accept data from its local application to be sent to the server. | — | ESTABLISHED | Client Close Step #1 Receive and Step #2 Transmit: The server receives the client’s FIN. It sends an ACK to acknowledge the FIN. The server must wait for the application using it to be told the other end is closing, so the application here can finish what it is doing. | CLOSE-WAIT |
FIN-WAIT-1 | Client Close Step #2 Receive: The client receives the ACK for its FIN. It must now wait for the server to close. | FIN-WAIT-2 | CLOSE-WAIT | The server waits for the application process on its end to signal that it is ready to close. | — |
FIN-WAIT-2 | The client is waiting for the server’s FIN. | — | CLOSE-WAIT | Server Close Step #1 Transmit: The server’s TCP receives notice from the local application that it is done. The server sends its FIN to the client. | LAST-ACK |
FIN-WAIT-2 | Server Close Step #1 Receive and Step #2 Transmit: The client receives the server’s FIN and sends back an ACK. | TIME-WAIT | LAST-ACK | The server is waiting for an ACK for the FIN it sent. | — |
TIME-WAIT | The client waits for a period of time equal to double the maximum segment life (MSL) time, to ensure the ACK it sent was received. | — | LAST-ACK | Server Close Step #2 Receive: The server receives the ACK to its FIN and closes the connection. | CLOSED |
TIME-WAIT | The timer expires after double the MSL time. | CLOSED | CLOSED | The connection is closed on the server’s end. |
|
CLOSED | The connection is closed. |
| CLOSED | The connection is closed. |
|