Normal TCP Close Phases
https://accedian.com/blog/close-tcp-sessions-diagnose-disconnections/
Figure 1 – Simplified TCP closing with FIN.
The standard way to close TCP sessions is to send a FIN packet, then wait for a FIN response from the other party.
- A sends a FIN packet and waits for a response; it can release some resources but awaits the response of the other part (Fin Wait)
- B receives the FIN packet and must release resources; it waits for a closing application level (Close Wait)
- B can now send a FIN to A and then await its acknowledgement (Last Ack wait).
- A can now fully close its job, but it must wait for network collision (?) (Time Wait); it may have to send the final ACK another time.
- B eventually receives the final ACK and destroys (kills) the connection.
This works fine in a perfect world. However, what happens when one part of the conversation is broken? That’s why the Reset (RST) packet exists.
TCP RESET
what happens when one part of the conversation is broken? That’s why the Reset (RST) packet exists.
Those abnormal terminations (i.e., either an aborted setup or a disconnection) could appear due to:
- A lack of resources or network interruption
- A crash/bug during the session
- While one pair has already closed its part of the connexion, the other part continues to send data
- The server refuses to open a connection to the client