What is the difference between flow control and congestion control?
MediumConceptFlow & Congestion Control
Answer
Flow control protects the receiver: it stops a fast sender from overflowing a slow receiver's buffer. Congestion control protects the network: it slows the sender down when routers along the path are overloaded and start dropping packets. Both limit how much unacknowledged data may be in flight.
- Flow control uses the receive window (
rwnd), which the receiver advertises in every ACK as the free space in its buffer. It is an agreement between the two end hosts, implemented with a sliding window. - Congestion control uses the congestion window (
cwnd), which the sender estimates for itself from signals such as packet loss or rising delay. No router tells it the value. - At any moment the sender may have at most
min(rwnd, cwnd)bytes unacknowledged, so whichever limit is smaller wins.
Example: A powerful server sends to a phone whose app has only 16 KB of buffer free, so rwnd = 16 KB and flow control limits the sender even on an empty network. Later the phone has 1 MB free, but the shared Wi-Fi is congested and packets drop, so the sender cuts cwnd to 20 KB; now congestion control is the limit. As an analogy, flow control is a guest saying "my plate is full", while congestion control is a driver slowing down on a jammed road.