Three-Way Handshake & Teardown
Read this concept as one more decision made about a packet in flight. The widget below lets you change the inputs and watch the consequence instead of memorising the rule.
Why it matters
Before data can flow, both endpoints must agree on initial sequence numbers and window sizes; at the end, both must agree that the stream is finished. Those agreements take explicit packets and time.
On the wire
The client sends SYN with its initial sequence number, the server answers SYN-ACK with its own, and the client replies ACK; data can ride in the third packet. Teardown uses FIN and ACK in each direction, with the active closer waiting in TIME_WAIT for twice the maximum segment lifetime.
When it breaks
A lost SYN-ACK causes the client to retransmit SYN with exponential backoff, so the connection appears to hang before it opens. A peer that disappears during teardown leaves the other side in FIN_WAIT or LAST_ACK until timers expire, accumulating sockets.
Handshake stepper
Send each message in order; drop one to see a timeout-driven retransmission.
Each message costs roughly one delay
Each step carries state the next one depends on, so ordering matters.