CoursesTCP to HTTPS, one request under a microscope
Puzzle 1 · 2 of 5
Where do the missing bytes go?
Drop one range of bytes while a later range arrives. Predict what the receiver reports and what the application can read.
All puzzles in this course
The problem
The phone sends three blocks of four bytes. They arrive as first, third, then second. Can the receiving app read the third block as soon as it arrives?
See it
Scroll sideways to see the full diagram.
The receiver accepts the first four bytes and expects 105.
Step 1 of 4The third range arrives while bytes 105 to 108 are missing.
Step 2 of 4The missing range arrives and fills the hole.
Step 3 of 4If the later range was kept, the next expected byte advances to 113.
Step 4 of 4
The building block
A cumulative acknowledgment reports the next byte needed to extend the contiguous prefix. Suppose the first byte has sequence number 101 and all three blocks are four bytes long.
| Received byte positions | Next number expected | What TCP can make available in order |
|---|---|---|
| 101–104 | 105 | 101–104 |
| 109–112 arrives early | 105 | Still only 101–104 |
| Missing 105–108 finally arrives | 113 | Now 101–112, if the later bytes were kept |
The receiver may buffer bytes that arrived ahead of a gap. It can still report 105, even though it has seen later bytes. The sender can send missing bytes again. When the gap closes, the acknowledgment can jump over the already buffered bytes.
TCP presents a continuous byte stream to the application. The app may read twelve bytes through one read or several, depending on when data is available and how much it asks for. The application has to understand its own message boundaries. It can't assume that one network segment equals one read or one complete message.
Go deeperLater data is useful without advancing the main acknowledgment
If the receiver tells the sender separately that it kept bytes 109–112, does the cumulative acknowledgment change?
It still reports 105. TCP selective acknowledgments can describe received ranges without claiming that the earlier gap is filled.
Check yourself
Sources
What you now know
A cumulative acknowledgment advances only across a contiguous prefix. Later bytes may wait while the receiver is missing earlier bytes.
Answer every question above correctly to unlock the next puzzle.
Something wrong or unclear on this page? Tell me: a puzzle that didn't click is a bug in the puzzle.