What is TCP Flow Control and How Does It Work?
Learn how TCP flow control works, the receive window, zero window, and how it differs from congestion control — with interview Q&A.
Expected Interview Answer
TCP flow control prevents a fast sender from overwhelming a slower receiver by having the receiver advertise how much buffer space it currently has left, via the receive window (rwnd) field in every ACK, so the sender never transmits more unacknowledged data than the receiver can actually hold.
Every TCP segment the receiver sends back includes a window size field stating exactly how many more bytes it is willing to accept right now, based on how full its own receive buffer is. The sender tracks this advertised window and caps how much unacknowledged data it has in flight to that limit, regardless of how much bandwidth is available on the path. If the receiving application is slow to read from the socket buffer, the buffer fills up, the receiver advertises a shrinking window, and can even advertise a window of zero to pause the sender completely until the application catches up. This is a receiver-driven, end-to-end mechanism, and it is distinct from congestion control, which protects the network itself rather than the receiving host; both limits are applied together, and the sender’s actual send window is the smaller of the two.
- Prevents a fast sender from overrunning a slow receiver’s buffer
- Lets the receiver dynamically signal available buffer via rwnd
- Supports a zero window to pause transmission entirely when needed
- Operates independently of, but alongside, congestion control
AI Mentor Explanation
TCP flow control is like a wicketkeeper signalling to the bowler exactly how many more balls of a certain pace they can comfortably collect before their gloves need a breather. If the keeper’s hands are getting tired, they raise fewer fingers, telling the bowler to slow the pace of deliveries; if fully rested, they signal full pace is fine. Should the keeper’s hands be completely overwhelmed, they can signal a full stop until they recover. The bowler never sends more than the keeper has just said they can handle, exactly as a TCP sender never exceeds the receiver’s advertised window.
Step-by-Step Explanation
Step 1
Advertise window
The receiver includes its current available buffer space as the window size (rwnd) in every ACK it sends.
Step 2
Sender caps in-flight data
The sender never has more unacknowledged bytes in flight than the most recently advertised window.
Step 3
Buffer drains or fills
As the receiving application reads data, the window grows; if it lags, the buffer fills and the window shrinks.
Step 4
Zero window / probe
A fully advertised zero window pauses the sender, which periodically probes with small segments until the window reopens.
What Interviewer Expects
- Correct definition: receiver-driven mechanism to prevent overrunning the receiver buffer
- Knows the receive window (rwnd) is advertised in every ACK
- Understands the zero-window and window-probe behavior
- Distinguishes flow control (receiver-protecting) from congestion control (network-protecting)
Common Mistakes
- Confusing flow control with congestion control
- Thinking the window size is fixed rather than dynamically advertised per ACK
- Not knowing about zero-window and window probing
- Assuming flow control accounts for network congestion, not just receiver buffer state
Best Answer (HR Friendly)
“TCP flow control is how a receiving computer tells the sender to slow down before it gets overwhelmed. The receiver constantly reports how much space is left in its buffer, and the sender only sends as much as that space allows — if the receiver’s buffer fills up completely, it can even tell the sender to pause entirely until it catches up.”
Code Example
# Capture packets and show the advertised window size field
sudo tcpdump -n -i any 'tcp' -v host example.com | grep -i win
# Example output line:
# 10.0.0.5.51000 > 93.184.216.34.443: Flags [.], ack 1001, win 65535, length 0
# Inspect current socket buffer sizes on Linux
cat /proc/sys/net/ipv4/tcp_rmemFollow-up Questions
- How does TCP flow control differ from congestion control?
- What happens when a receiver advertises a zero window?
- How does window scaling extend the maximum receive window?
- What is Silly Window Syndrome and how is it avoided?
MCQ Practice
1. What does the TCP receive window (rwnd) primarily represent?
The receive window advertises how much buffer space the receiver currently has available for incoming data.
2. What happens when a receiver advertises a window of zero?
A zero window tells the sender to stop; the sender periodically sends small probe segments until the window reopens.
3. Flow control primarily protects against:
Flow control is receiver-driven and protects the receiving host’s buffer, unlike congestion control which protects the network.
Flash Cards
What is TCP flow control? — A receiver-driven mechanism that caps how much unacknowledged data a sender can have in flight, based on the receiver’s buffer space.
What field advertises this limit? — The receive window (rwnd) field, sent in every ACK.
What is a zero window? — A signal that the receiver’s buffer is full, pausing the sender until it reopens.
Flow control vs congestion control? — Flow control protects the receiver’s buffer; congestion control protects the network path.