Lesson 3 of 9 · 25m
Sequence Numbers, ACKs, and Windows: How TCP Keeps Score
How byte-oriented sequence numbers, cumulative acknowledgments, receive windows, scaling, and TCP timestamps interact to control throughput and loss recovery.
TCP reliability is bookkeeping. Every byte has a sequence number, every acknowledgment says “I have everything before this point,” and every advertised window says “I can buffer this much more.” Once you read those numbers as ledger entries instead of magic Wireshark columns, throughput and loss behavior become predictable.
Sequence numbers count the byte stream
If a sender starts at sequence 1000 and sends 500 bytes, the next byte is sequence 1500. Retransmitting those same bytes still uses the same sequence range. That is the point: duplicate delivery is detectable because the byte identity never changes.
seq=1000 len=500 covers bytes 1000..1499
next expected 1500
ACK 1500 means bytes before 1500 arrivedACKs are cumulative. ACK 7000 acknowledges all earlier contiguous bytes, not merely the segment that triggered it.
Reordering is normal, gaps are the signal
If bytes 1000–1999 and 3000–3999 arrive but 2000–2999 do not, the receiver can only acknowledge 2000. It may generate duplicate ACKs while later data keeps arriving. Those duplicate ACKs are evidence of a hole, not proof by themselves that the hole is permanent.
receiver sees: 1000..1999, 3000..3999
receiver sends: ACK 2000, ACK 2000, ACK 2000
meaning: “I still need byte 2000”The receive window is credit
The TCP header’s window field advertises available receive buffer space. A window of zero means “stop sending until I reopen the window.” Because the header field is only 16 bits, high-bandwidth networks rely on the TCP window-scale option negotiated during the handshake.
Window: 64240
Window scale: 8 (multiply by 256)
Effective scaling applies to advertised windows after SYNIf the handshake lacks window scaling, later claims of huge windows are impossible. Wireshark can only interpret scaling correctly when it sees the handshake — a practical reason to start captures before the connection begins.
Throughput is bounded by window and RTT
A rough ceiling is:
throughput <= receive window / round-trip timeWith a 64 KiB window and 100 ms RTT, the ceiling is roughly 65536 / 0.1 = 655 KB/s. Increasing bandwidth does nothing if the window cannot cover the bandwidth-delay product. This is why transoceanic transfers behave badly with small buffers and why window scaling matters.
Timestamps help measure and protect
TCP timestamps are negotiated at handshake time. They let endpoints estimate RTT more accurately and protect against wrapped sequence numbers on very fast connections. They are not wall-clock time, so do not treat them as packet capture timestamps.
Field notes
- Duplicate ACKs mean a sequence hole; three or more often trigger fast retransmit.
- Zero-window probes are normal behavior when a receiving application stops reading.
- A small advertised window may be backpressure from the application, not a broken network.
- If Wireshark reports impossible window sizes, check whether the capture includes the SYN and SYN-ACK.
- SACK blocks refine loss information, but cumulative ACK remains the backbone of TCP’s ledger.
Was this lesson helpful?