TCP connection teardown
When either host wants to end a TCP connection they follow a teardown protocol:
- The client sends an empty finish message with the FIN bit set to 1.
- The server sends an acknowledgement message for that closing message.
- After the server has closed off the connection it sets an empty finish message with the FIN bit set to 1.
- Lastly the client sends an empty acknowledgement message for that finish message. This is sent again after short delay to increase the chance that is received.