Module 05 · Networking · Build it yourself · with code: Python · about 14 min to read
Continue where you left off ×
Build it: the page that gets through (stop-and-wait, then a window)
Postcards and Phone Calls · Open board
The postcard and the phone call. TCP builds the call out of postcards that may vanish. This lesson builds a small call of its own, on a road that loses and delays postcards on purpose, and watches what each design costs.
Before you start. The page that never arrived (TCP reliable delivery) told the idea: number every page, answer with “got it”, resend after a timeout, and keep several pages on the road at once with a window. Here you write that, in about 40 lines each, and measure it. TCP vs UDP, and the 3-way handshake gave the picture underneath: the network only carries postcards, and TCP is a phone call made from them. A later lesson, Build it: only the lost page (selective repeat, loss and reordering) , finishes the job with selective repeat. You need Python 3 and nothing else.
The idea in 30 seconds
Stop-and-wait sends one page, waits for its ack, then sends the next, so it moves exactly one page per round trip no matter how fast the road is.
A sender cannot tell a lost page from a lost ack, so the receiver must ack every page it hears, even a repeat, or one lost ack hangs the transfer forever.
A window keeps up to W pages unacknowledged at once, so throughput is about W pages per round trip: on the test road, doubling W doubled the speed from 1 to 32.
A cumulative ack says “I have everything before this number”, so one ack can cover several pages and rescue a lost ack.
The bandwidth-delay product is how many bits fit on the road in one round trip, and the window has to be at least that big to keep the road full. TCP’s original 16-bit window field capped it at 65,535 bytes, which is why RFC 1072 proposed a scale factor in 1988.
Read the story
Lesson 40 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 plans Already a member? Sign in
Or start free : a free account opens lessons 2 and 3 of every track.
In this lesson October 1988: a road too long for the window The road we build on Stop-and-wait: send one, wait for the note What it costs: one page per round trip A window: eight on the road at once The arithmetic Review Networking
Mark as read Saved in this browser, and to your account when you sign in.