The idea
The three-way handshake introduced rwnd without explaining it. Flow control is where that gets answered — how the receiver actually paces a sender that could otherwise flood it. Sitting alongside flow control is error control: catching the ways a segment can go wrong once it is in transit, whether that is corruption, loss, or simply arriving in the wrong order.
How it works
Flow control
Flow control balances the rate the sender transmits at against the rate the receiver can actually use what arrives. TCP manages this by controlling the transmission window size at both the sender and the receiver. The receiver controls how much data can be in flight through its receive window size (rwnd), and the sender is expected to obey it.
- rwnd
- Receive window advertised to the sender, in bytes
How it works
Window dynamics
rwnd gets smaller as more bytes arrive from the sender and sit unread in the buffer. It opens back up (gets bigger) as more bytes are pulled out of the buffer by the receiving process.
How it works
Lost ACK scenario
Host A sends a segment with sequence number 92, carrying 8 bytes, with its send base at 92. Host B’s acknowledgment, ACK=100, is lost on the way back. Host A’s timer expires with no ACK received, so it retransmits the same segment (Seq=92, 8 bytes) — data Host B already has. Once the exchange recovers, Host A’s send base advances to 100, a further segment (Seq=100, 20 bytes) is sent, the send base advances to 120, and Host B’s ACK=120 confirms it.
The lecture notes this scenario resembles Go-Back-N ARQ: from Host A’s point of view, no confirmation arrived, so it retransmits, exactly as Go-Back-N does when feedback goes missing — even though, in this case, the original data was never actually lost.
Aside
The original slide lays this scenario out as a two-column timing diagram, sender and receiver side by side. That column alignment did not survive text extraction, so the exact interleaving of these events is not guaranteed here — the values and the stated outcome (a retransmission caused by a lost ACK) are reproduced as the lecture gives them.
How it works
Premature timeout
A related scenario: Host A sends three segments in sequence — Seq=92 (8 bytes), Seq=100 (20 bytes), and Seq=120 (15 bytes). Host B’s ACK=100 confirms the first. A later ACK, ACK=120, arrives and — because TCP’s acknowledgments are cumulative — covers for an earlier lost ACK along the way. Host A never needs to retransmit, because the later cumulative ACK already confirms everything the missing one would have.
Where marks get lost
A lost ACK is not always a wasted retransmission
The Lost ACK scenario and the Premature Timeout scenario look similar but end differently. In the first, the sender’s timer runs out before any later ACK rescues it, so a retransmission happens. In the second, a later cumulative ACK arrives in time and quietly covers for the lost one — no retransmission needed. Whether a lost ACK costs anything depends entirely on timing against the sender’s timer.
How it works
TCP fast retransmit
If the sender receives three additional ACKs for the same data — a triple duplicate ACK — it resends the unacknowledged segment with the smallest sequence number, without waiting for a timeout. The logic: three segments arriving after a missing one each still generate an ACK requesting that missing segment, so three duplicates in a row are a strong signal the segment was lost. TCP fast retransmit implies selective repeat — it resends specifically the one segment that is missing, not everything sent after it.
Worked example
Three duplicate ACKs
Client sends segments 1 through 6 in sequence.
Server ACKs segment 1 with ACK=2 — the next byte-of-segment it expects.
Server ACKs segment 2 with ACK=3. Segment 3 is then lost.
Segments 4, 5 and 6 each arrive after the gap. Since segment 3 is still missing, the server responds to each of them with the same acknowledgment, ACK=3 — three duplicate ACKs in a row, all still asking for segment 3.
The sender treats the third duplicate ACK as confirmation that segment 3 is lost, and fast-retransmits it immediately, rather than waiting for its timer to expire.
AnswerAfter the third duplicate ACK=3, the sender fast-retransmits segment 3 without waiting for a timeout.
How it works
TCP error control
Error control detects and corrects four kinds of fault:
- Corrupted segments
- Lost segments
- Out-of-order segments
- Duplicated segments
It does this with two mechanisms: a checksum embedded in the TCP segment, and acknowledgements and timeouts.
Worked example
Checksum weak-protection example
The lecture demonstrates a weakness in the checksum by adding two 16-bit header values, E666 and D555:
Write both values in binary. E666 =
1110011001100110. D555 =1101010101010101.Add them as ordinary binary numbers. The result overflows 16 bits — the lecture shows the raw, pre-wraparound sum bit by bit as
1 1011101110111011(17 bits).Apply the end-around carry (fold the 17th bit back into the low-order bit) to bring the result back to 16 bits, giving the wraparound sum
1011101110111100.Take the one’s complement (flip every bit) of the wraparound sum to get the checksum:
0100010001000011.
The lecture’s own point: even though the header values have changed (bit flips), the checksum can come out the same — a weak-protection case the checksum by itself cannot catch.
AnswerBoth headers sum to the same 16-bit checksum, 0100010001000011 — a bit-flip case the checksum cannot catch.
Aside
The slides’ step-by-step checksum calculation walkthrough, including the general wraparound-arithmetic procedure, did not survive extraction — only this one worked example did. The lecture also asserts this specific example shows a checksum that stays the same despite bit flips, but does not show the “before” value being compared against — only the one computation above is reproduced here, since the comparison case is not present in the source.
In the exam
- rwnd = buffer size − bytes waiting to be pulled. Know which direction it moves: shrinks on arrival, grows on the process reading data out.
- A lost ACK does not automatically mean a wasted retransmission. It depends on whether a later cumulative ACK arrives before the sender’s timer expires.
- Fast retransmit fires on three duplicate ACKs for the same data, and resends only the smallest unacknowledged sequence number — it does not wait for a timeout, and it implies selective repeat, not go-back-N.
- Error control’s four faults: corrupted, lost, out-of-order, duplicated — caught via checksum plus acknowledgements and timeouts.
- The checksum is a weak error check. The E666/D555 example shows a specific pattern of bit flips a checksum will not detect.
Check yourself
- rwnd shrinks as data arrives unread, grows as the process reads it — the sender is expected to obey it.
- A lost ACK triggers a retransmission only if no later cumulative ACK rescues it before the timer runs out.
- Three duplicate ACKs trigger a fast retransmit of the smallest unacknowledged sequence number, without waiting for a timeout.
- TCP error control catches corrupted, lost, out-of-order and duplicated segments using a checksum plus acknowledgements and timeouts — and the checksum alone is not proof against every kind of corruption.