How TCP tears down a connection in FIN → ACK → FIN → ACK, and why the closer waits in TIME_WAIT for 2MSL — animated sequence diagram.
Scenario
Current step 6/6
The client waits in TIME_WAIT for 2×MSL (~30–120s) — a safety margin in case the last ACK was lost and the server retransmits FIN.
Round trips to first byte
1 RTT
FIN/ACK overlap in both directions — about one round trip
Numbers above arrows are the step order. In TLS 1.3, parts in {} are already encrypted — the certificate that was plaintext in 1.2 is hidden. Brackets [] mark conditional messages sent only with those cipher suites.
TCP teardown takes one more message than setup because 'I'm done sending' (FIN) and the peer's own FIN are separate events. The server ACKs the client's FIN immediately but may still have data to send — the CLOSE_WAIT half-close gap.
TIME_WAIT is the subtle part: after the final ACK the client holds the socket for 2×MSL. If that ACK is lost the server retransmits FIN, and a socket that vanished couldn't answer — leaving the server's close hanging.
On servers, a pile of CLOSE_WAIT sockets usually means the application received FIN but never called close() — a classic connection-leak symptom. TCP/TLS Handshake Visualizer