Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 02 · Networking · How a packet finds a house · with code: Python · about 14 min to read

Play it as a journeyTutor comes with a plan

The hold line (the listen queue, and the SYN flood)

TCP Handshake
TCP Handshake · Open board

The TCP handshake in real bytes: SYN, SYN+ACK, ACK, each with its random starting number. This lesson is about the server’s side of that drawing: what it writes down after the second message, and what happens when millions of callers never send the third.

Before you start. From TCP vs UDP, and the 3-way handshake you have the phone call: TCP opens with three messages (“can you hear me?”, “yes, and can you hear me?”, “yes”), each side says a random starting number, and the return address on a packet is whatever the sender wrote, so it can be forged. From The page that never arrived (TCP reliable delivery) you have the server’s half in code: a program claims a port and waits (LISTEN), and accept() hands it each finished call as a new socket. This lesson is what happens between those two, when calls come in faster than the program picks them up.

Lesson 16 of 44 in Networking

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 6 September 1996: an ISP’s mail goes silent, and nothing is broken
  • Who answers the phone: the kernel, not your program
  • Between hello and yes: the half-open call, and the SYN queue
  • Finished calls on hold: the accept queue and the backlog
  • The flood: forged hellos that never say yes
  • The trick: write the note into the number you read back
  • A hold line that fills
  • How big the two queues may be
  • A SYN cookie by hand

Terms it explains: half-open connection, SYN queue, accept queue, backlog, SYN flood, SYN cookie.

Lab

The pipe is 100 Mbps and the file is 1 MB. Why does the round-trip time decide how long it takes?

Drag How far away the server is out to the satellite, then press Play next flight and watch The clock.

Open The TCP handshake

Related paper

Review Networking