AlgoViz
—
← Back to trail

The TCP Handshake

Easy+10 XP

Before two computers send data, they shake hands three times — SYN, SYN-ACK, ACK. Watch the hello dance.

No visualization loaded.

Watch

—

i

Press Run to begin.

Two computers can't just start hurling data at each other — first they make sure the other side is awake and listening. They do it with a tiny three-step hello called the TCP handshake. Press Run and watch the packet bounce: SYN, then SYN-ACK, then ACK — and the line goes green for 'open.'

▸Why three messages? Why not just one 'hi'?

Because BOTH sides need proof the other can hear them. Message 1: laptop says hi (server now knows the laptop can send). Message 2: server says hi back (laptop now knows the server heard it AND can send). Message 3: laptop confirms (now the server knows the laptop heard the reply). After three, each side is sure the other can both send and receive.

▸What do SYN and ACK actually mean?

SYN is short for 'synchronize' — 'let's start a connection and agree on where to begin.' ACK is short for 'acknowledge' — 'I got your message.' SYN-ACK is just both at once: 'I got your hello, and here's my hello back.'

▸What is TCP, exactly?

TCP is the set of rules that makes data arrive complete and in order, like a careful courier who checks off every package. The handshake is how TCP opens a connection before any of that careful delivery begins. (Its faster, no-handshake cousin is UDP — it just fires data off and hopes.)

▸Does this happen every single time I load a website?

Once per connection. Opening a page can reuse one connection for many requests, so you don't pay for a new handshake on every image. But the very first time your browser talks to a new server, this three-step hello happens — and it costs one round trip before any real data moves.

🧠SYN, SYN-ACK, ACK — a three-step hello that proves both computers can hear each other before any real data flows. Every TCP connection on the internet starts with this dance.
SYN (let's talk)SYN-ACK (heard you, hi back)ACK / connection open