TCP 3-Way Handshake

Watch the SYN → SYN-ACK → ACK sequence establish a TCP connection — sequence numbers and SYN_SENT/ESTABLISHED state transitions animated step by step.

Scenario

Speed
TCP SETUPDATA TRANSFERClientServer1SYN seq=1002SYN, ACK seq=300 ack=1013ACK seq=101 ack=3014HTTP GET /
ClientESTABLISHED
ServerESTABLISHED

Current step 4/4

HTTP GET /

Application data now flows — over TLS as encrypted records.

Round trips to first byte

1 RTT

Data can flow right after the single handshake round trip

TCP segmentTLS handshakeApplication data

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.

The 3-way handshake is the minimum round trip needed for a reliable connection: the client sends SYN with its initial sequence number (ISN), the server answers SYN-ACK with its own ISN plus client ISN+1, and the client confirms server ISN+1 with a final ACK.

Three messages are required because both directions need initialization. After SYN-ACK only the client knows the server's ISN — the server can't be sure its message arrived until the third ACK. That's when both sides reach ESTABLISHED.

Sequence numbers anchor each direction's byte stream: ack=101 means 'I have everything up to 100, expecting 101' — the acknowledgment mechanism that carries TCP's retransmission and ordering. TCP/TLS Handshake Visualizer

Frequently asked questions

Why three messages and not two?
Each side must confirm its sequence number reached the other. After SYN-ACK only the client is sure; the server needs the third ACK to know its SYN arrived. Three is the minimum for mutual confirmation.
What does a stuck SYN_SENT mean?
SYN was sent but no SYN-ACK came back — the host isn't responding or a firewall is dropping SYNs. An RST instead means the port is closed.
Where does a SYN flood attack hit this?
Step two: attackers send SYNs but never the final ACK, filling the server's half-open queue. SYN cookies are the standard defense.

Other scenarios