Master the fundamental concepts of tcp/ip from scratch through this focused micro-challenge.
TCP's 16-bit window field tells the sender how many unacknowledged bytes it may have in flight. For example, with window 4000 the sender can transmit bytes 0 through 3999 before waiting for an ACK.
When ACK=1000 arrives, bytes 0-999 are acknowledged and the window slides:
1000-3999 (3000 bytes)4000-4999The sender tracks four regions: acknowledged, in-flight, sendable-within-window, and blocked-outside-window.
If the receiver buffer fills up, it advertises window 0. The sender probes with 1-byte segments until space opens. Throughput is bounded by window / RTT: a 65535-byte window on a 100ms RTT link caps around 5 Mbps without window scaling (RFC 7323). The receiver advertises available buffer space in every ACK; as the application reads data, the window grows and the sender can push more bytes in flight toward destinations like 10.0.0.5:8080.
This task asks you to simulate sliding window flow control. The Linux kernel auto-tunes receive buffers per socket (net.ipv4.tcp_rmem) based on exactly this mechanism. RFC 7323's window scaling option exists because the 16-bit window field caps throughput at roughly 5 Mbps on a 100ms-RTT link without scaling beyond 65535 bytes.
Implement a simulation of TCP sliding window flow control.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github