TCP Sliding Window Workbench

Trace sender windows, receiver windows, cumulative ACKs, zero-window backpressure, and bandwidth-delay limits

animation
tcp
protocols
transport
flow-control
Interactive TCP sliding window workbench showing sender sequence space, receiver advertised windows, cumulative acknowledgments, bytes in flight, zero-window pauses, loss gaps, and IoT buffer trade-offs.
Transport Flow control Sequence space IoT latency

TCP Sliding Window Workbench

Follow the sender's left edge, next sequence number, receiver advertised window, and cumulative ACK as TCP keeps data moving without overflowing the receiver.

4 seg Effective send window
0 B Bytes in flight
12.8 kb/s Window per RTT

Visual trace

Watch the window edges move

Start with a normal pipeline, then switch to full-window, zero-window, and loss scenarios.

Ready
0 B Send base
0 B Next sequence
4 seg Available send room
3.1 seg BDP target window
Sender byte stream Green is ACKed, teal is sent, purple border is currently sendable.
Receiver buffer Orange arrived in order; red is a gap blocking the cumulative ACK.
Press Step to send bytes within the advertised window. The sender cannot move the left edge until an ACK confirms earlier bytes.

What changed?

No bytes are in flight yet. The sender can transmit while SND.NXT stays below SND.UNA plus the usable window.

Window diagnosis

The effective sender limit is the smaller of the receiver's advertised window and the congestion-control cap.

1. Open window

The receiver advertises space. The sender gets permission to place bytes in flight.

2. Send ahead

SND.NXT advances as segments are transmitted before earlier ACKs return.

3. Cumulative ACK

An ACK names the next expected byte, so all lower bytes are confirmed.

4. Receiver backpressure

A smaller rwnd reduces the usable send window and slows the stream.

5. Zero window

rwnd = 0 pauses new data; a persist probe checks whether space has returned.

6. Missing byte range

Cumulative ACKs cannot jump a gap, so duplicate ACKs repeat the same next byte.

What is the window?

It is a moving byte range. Bytes below the left edge are ACKed; bytes inside the range may be sent; bytes beyond it must wait.

Why cumulative ACKs?

ACK 1600 means the receiver has every byte before 1600 and wants byte 1600 next. It does not need one ACK per segment.

Why rwnd matters

The receiver advertises available buffer space. A small rwnd protects memory but can leave the link under-used.

Why IoT teams care

Small RAM, radio duty cycle, and long RTT links make window size a real design trade-off for telemetry gateways and devices.

Quick reference

Read the sender and receiver state

Use these rules to check each scenario before opening the deeper notes.

Sender terms

  • SND.UNA: first unacknowledged byte.
  • SND.NXT: next byte the sender plans to transmit.
  • Bytes in flight: SND.NXT - SND.UNA in this simplified model.

Window formulas

  • send_limit = min(rwnd, cwnd).
  • available = send_limit - bytes_in_flight.
  • window rate is roughly send_limit bytes per RTT.

Receiver behavior

  • ACK names the next expected byte, not the last received byte.
  • Out-of-order data can be buffered, but the cumulative ACK stays at the gap.
  • rwnd = 0 means pause new data until space is advertised again.
Check Formula or rule Meaning
Allowed byte range SND.UNA through SND.UNA + send_limit - 1 The sender must not place new bytes beyond the right edge.
Available send room send_limit - (SND.NXT - SND.UNA) How many more bytes can be sent before an ACK arrives.
Bandwidth-delay product BDP = bandwidth x RTT A window smaller than BDP cannot keep the path full.

Practice 1

Set rwnd to 3 segments and press Step until the sender waits. Which readout reaches zero first?

Practice 2

Use the Lost segment scenario. Why does ACK stay at the missing byte even when later segments arrive?

Practice 3

Raise RTT to 700 ms. Compare the effective window with the BDP target and decide whether the path is under-filled.

Deeper TCP notes and technical caveats

Teaching simplifications

This workbench groups bytes into equal teaching segments so the state is readable. TCP sequence and ACK numbers count bytes; SYN and FIN also consume one sequence number, but this page focuses on established data transfer.

Real TCP sender behavior is also limited by congestion control. The congestion cap control is included so you can see why the usable window is normally the smaller of receiver flow control and congestion-control state.

Operational details

Classic TCP window fields are 16 bits, so TCP Window Scale is used when larger receive windows are needed. Zero-window probing is simplified here as a one-byte persist probe; exact timers are implementation dependent.

Delayed ACK, selective acknowledgment, retransmission timeout, and fast retransmit can change the detailed trace. The cumulative ACK behavior shown here remains the baseline mental model.

Sources

Primary references and next steps

Use these when checking terminology, formulas, and TCP edge cases.