Explain how TCP provide a flow control service by using different variables.
How the receive window enforces flow control
The TCP header includes a window field that carries the receiver’s current receive window. This tells the sender the maximum amount of data (in bytes) that the receiver can accept beyond what has already been acknowledged. 2
Usable window at the sender
At any moment, the sender can conceptually compute a bound of the form:
Where:
- “in-flight bytes” is the amount of data sent but not yet acknowledged (a function of sequence numbers and ACK state).
- “rwnd” is the receiver’s advertised capacity.
So the sender uses:
- the receiver’s cumulative ACK to determine what is already safely received,
- plus the receiver’s advertised window to determine what additional bytes may be sent without overflowing the receiver buffer. 2
Sliding-window consequence. As the receiver consumes data from its buffer, it increases the advertised rwnd; as it fills, it decreases it. This continually “slides” the permissible sending region forward without requiring per-packet coordination.
Footnotes
-
(RFC 793) Transmission Control Protocol (https://www.rfc-editor.org/rfc/rfc793) - Defines TCP’s acknowledgment, window, and sliding-window behavior in terms of send/receive sequence space and the advertised window. ↩ ↩2 ↩3
-
TCP flow control and zero-window behavior explanation (https://www.rfc-editor.org/rfc/rfc1122) - Contains host requirements including how windowing and acknowledgment/window update behavior should function, including handling of zero windows. ↩ ↩2
TCP Flow Control with ACK + rwnd (Sliding Window)
- 1Step 1
- 2Step 2
As segments arrive in order (or as allowed by TCP’s reassembly rules), the receiver places data into its receive buffer and tracks how much free space remains. The receiver’s free space determines the advertised rwnd.
- 3Step 3
For received data, the receiver sends segments carrying (1) a cumulative ACK for the next byte it expects, and (2) the current window value representing how much additional data it can accept.
- 4Step 4
Upon receiving the latest ACK+window, the sender updates its usable sending limit so that outstanding (unacknowledged) bytes do not exceed the receiver’s advertised rwnd.
- 5Step 5
The sender increases SND.NXT to send new data, but stops (or refrains from further new data) once sending would exceed the window constraint.
- 6Step 6
As the application reads from the receive buffer, the receiver frees space, increases rwnd, and transmits updated ACK+window advertisements, allowing the sender to send more.
Differentiating flow control variables from congestion control variables
TCP has two related but distinct control services:
- Flow control protects the receiver’s buffer capacity (receiver-advertised window: rwnd).
- Congestion control protects the network path capacity (sender-side congestion window, cwnd).
The sender therefore typically limits sending by the combination of:
- rwnd (flow control)
- cwnd (congestion control)
Conceptually:
This means that even if the receiver advertises large rwnd, the sender may still be limited by cwnd when congestion control reduces it; conversely, even if cwnd is large, a small rwnd will throttle the sender to prevent receiver overflow.
Footnotes
-
(TCP Congestion Control overview) RFC 5681 TCP Congestion Control (https://www.rfc-editor.org/rfc/rfc5681) - Separates congestion control concepts (cwnd) from receiver-side flow control via advertised windows. ↩
Flow control uses receiver knowledge
"If you can identify the receiver-advertised field (rwnd/window) in the TCP segment, you are looking at flow control. If you see cwnd/ssThresh behavior changes without reference to receiver buffer space, you are looking at congestion control."
Footnotes
-
(TCP Congestion Control overview) RFC 5681 TCP Congestion Control (https://www.rfc-editor.org/rfc/rfc5681) - Separates congestion control concepts (cwnd) from receiver-side flow control via advertised windows. ↩
Small window values can cause stalls
"When rwnd becomes 0, the sender must stop sending new data and rely on window-probe behavior (and eventual window reopening) rather than continuing to transmit and risking receiver buffer overflow. This is a direct consequence of the receiver explicitly advertising no available space."
Footnotes
-
TCP flow control and zero-window behavior explanation (https://www.rfc-editor.org/rfc/rfc1122) - Contains host requirements including how windowing and acknowledgment/window update behavior should function, including handling of zero windows. ↩
Zero-window and window reopening (why “rwnd=0” matters)
A receiver may advertise rwnd as 0 when its receive buffer is full. The sender then cannot legally send additional bytes beyond the already acknowledged data. When the receiver drains enough buffer space, it sends an updated ACK with a non-zero window to reopen the flow-controlled sending ability. This handshake pattern ensures correctness and protects receiver capacity.
Footnotes
-
TCP flow control and zero-window behavior explanation (https://www.rfc-editor.org/rfc/rfc1122) - Contains host requirements including how windowing and acknowledgment/window update behavior should function, including handling of zero windows. ↩
Receiver Buffer → Advertised rwnd → Sender Sending
Receiver has free buffer
Initial stateReceiver advertises an available rwnd."
Buffer fills
Data arrivesAs unread data accumulates, the receiver reduces advertised rwnd."
Sender throttles
Sender adaptsSender limits outstanding data using ACK + rwnd boundary."
Buffer drains
Application readsReceiver increases rwnd and sends updated ACK+window."
Sliding window continues
Sustained transferThrough continual ACK+window updates, the sending rate tracks receiver capacity."
Variables summary table (what each represents)
| Variable / Field | Whose perspective | What it measures | Role in flow control |
|---|---|---|---|
| rwnd | Receiver (advertised) | How many additional bytes receiver can accept | Hard upper bound on sender’s in-flight data |
| ACK | Receiver (returned) | Next byte expected (cumulative) | Defines which sent bytes are already “safe” |
| SND.NXT | Sender | Next byte index to send | Advances only when allowed by effective window |
| SND.UNA | Sender | Oldest unacknowledged byte | Helps compute in-flight amount |
| cwnd | Sender | Network congestion allowance | Combined with rwnd as |
Knowledge Check
Which TCP mechanism most directly provides flow control to prevent receiver buffer overflow?