Protocol in Code · Track

TCP

connection state, timers, and recovery as explicit variables

11 sessions Course material (English)

Sessions

TCP track sessions

Session 01

A Segment Carries the Conversation State

What does a TCP segment actually carry, and what makes a combination of flags and payload nonsensical before anyone even looks at what state the connection is in?

Open Session 01
Session 02

It Takes Three Packets to Say Hello

Why does establishing a connection take exactly three segments, and what state is each side in after each one?

Open Session 02
Session 03

Sequence Numbers Wrap Around

Sequence numbers are 32-bit and wrap back to zero — so what does "before" even mean once a connection has been running long enough to cross that boundary, and why is plain < the wrong tool to answer it?

Open Session 03
Session 04

The Window Is How Much Room You Have

What is the TCP receive window, really, and why is it never a number you store — only a number you compute?

Open Session 04
Session 05

The Timer Learns the Network

How does TCP decide how long to wait before declaring a segment lost, when the "right" answer changes every round trip?

Open Session 05
Session 06

Three Duplicates Mean Loss

How does a sender infer a lost segment from ACKs alone, without waiting for a retransmission timer to expire?

Open Session 06
Session 07

cwnd Is Just a Variable

Congestion control has a reputation for being an algorithm. Read as code, is it anything more than a handful of rules for moving one integer up or down?

Open Session 07
Session 08

Out of Order Is Not Lost

When a segment arrives ahead of where the receiver expects, what actually happens to it, and what makes the receiver able to catch up in one step once the gap closes?

Open Session 08
Session 09

Goodbye Takes Four Packets (and a Wait)

Why does closing a TCP connection take four segments and a wait, instead of ending the moment one side is done talking?

Open Session 09
Session 10

RST Ends Everything Now

Teardown takes four packets and a wait — so what does a connection that ends with a RST skip, and what decides whether a RST is even allowed to end it?

Open Session 10
Session 11

Build the Toy TCP Loop

What does one endpoint's whole life look like when handshake, data delivery, congestion, reset, and teardown are all wired into a single object instead of ten separate demos?

Open Session 11