skipnothing/HTTP & Networking

Windows & Retransmits

tcpdump prints a line like win 502 on nearly every acknowledgment, and that one field encodes a live ceiling: send past the ceiling and the receiver has offered no room for the bytes, so the sender waits.

  • ▸A receiver short on buffer space advertises zero, even with bytes free, and the sender waits rather than dies.
  • ▸Repeated acknowledgments for the same byte are enough to resend a lost segment, no timer required.
  • ▸The window tcpdump prints can be off by a hundredfold, because the real value is shifted.
BUILDS ON
01

The window is a moving cap

We're at the transport layer, inside one open connection. A sender with a megabyte to push does not get to push a megabyte. On every acknowledgment it receives, the receiver includes a number: how many more bytes it will accept beyond the byte it just confirmed, a number computed from its free buffer space. That number is the receive window, and the sender treats it as a hard ceiling on its in-flight bytes, the data it has sent but not yet had acknowledged. Reach the ceiling and the sender stops, even with plenty left to send and the network wide open.

The ceiling moves. When the receiving application reads slowly, bytes pile up in the kernel buffer, free space drops, and the next acknowledgment quotes a smaller window. Drain the buffer and the window quoted grows again. ss -tan shows the same story from outside the connection: a climbing Recv-Q is the buffer filling, and the advertised window shrinks in step with it. The window is not a setting anyone dialed in; it is computed from one buffer's free space and re-sent with every acknowledgment. Linux holds it at zero until the reader frees a large block, then reopens it in one jump.

METER THE WINDOW AGAINST THE BUFFER

Keep going, sign up to unlock the rest

4 more parts in this topic, plus 23+ more topics in HTTP & Networking.

Sign up, it's freeSee the full HTTP & Networking