TCP begins with a three-way handshake that establishes both directions of the connection and synchronizes initial sequence numbers. Connection teardown is different: it typically uses FIN/ACK exchanges because each direction of a TCP connection can close independently.
Remember the shape, not the sentence
“Think of a phone call: 'Can you hear me?' → 'Yes, I can hear you.' → 'Great, I can hear you too.' The handshake proves both sides can exchange state before application data flows.”
SYN
The client sends a SYN with an initial sequence number. The server creates connection state and acknowledges it.
SYN-ACK
The server replies with its own initial sequence number and an acknowledgement for the client's SYN.
ACK
The client acknowledges the server's SYN. Both sides now have synchronized sequence-number state and can proceed.
See the mechanism before you memorize it
One diagram, one causal story, one reconstruction task.
Animated 3-way handshake + teardown — causal map
Client → Server
SYN, Seq=x
Server → Client
SYN-ACK, Seq=y, Ack=x+1
Client → Server
ACK, Ack=y+1
Data
Application bytes can now flow according to TCP state.
Draw the idea yourself
Rebuild the core flow on a real canvas before moving to the worked walkthrough.
Walk the system
Client → Server
SYN, Seq=x
Server → Client
SYN-ACK, Seq=y, Ack=x+1
Client → Server
ACK, Ack=y+1
Data
Application bytes can now flow according to TCP state.
Close
FIN/ACK sequences independently close each direction.
Handshake on the wire
The +1 matters because SYN consumes one sequence number. This is a favorite detail in packet-analysis questions.
C → S SYN Seq=100
S → C SYN-ACK Seq=900 Ack=101
C → S ACK Ack=901What usually goes wrong
Close the tab. Rebuild it from memory.
Read the question, answer aloud, then reveal.
Why three messages instead of two?Reveal answer
Both endpoints need to establish and acknowledge their sequence-number state so each side knows the other side received the information.
What does the +1 represent?Reveal answer
SYN occupies one sequence-number position, so the acknowledgement advances by one.
Why can TCP close in more than one exchange?Reveal answer
The connection is full-duplex; each direction can close independently.
Make this idea travel.
Connect it next to: tcp-reliability • tcp-flow-congestion • udp-quic.