← Lessons

quiz vs the machine

Gold1390

Networking

The Three Way Handshake Revisited

How SYN, SYN ACK, and ACK set up sequence numbers before data flows.

4 min read · core · beat Gold to climb

Why a handshake

TCP is reliable and ordered, which means both sides must agree on a starting point before any data moves. The three way handshake exchanges initial sequence numbers and confirms that both directions of the connection actually work.

The three steps

  • The client sends a SYN carrying its initial sequence number.
  • The server replies with a SYN ACK, acknowledging the client number and sending its own.
  • The client sends an ACK of the server number, and the connection is established.

Each side learns and acknowledges the other starting sequence number, so later segments can be ordered and gaps detected. Only after this exchange does TCP consider the connection open for data.

What the handshake costs

The handshake adds one round trip of latency before the first byte of data. On high latency links this matters, which is why protocols layered on TCP try to reuse connections rather than open a fresh one per request.

Key idea

The three way handshake of SYN, SYN ACK, and ACK synchronizes sequence numbers and confirms both directions before data is sent.

Check yourself

Answer to earn rating on the learn ladder.

1. What is exchanged during the three way handshake?

2. What is the latency cost of the handshake?