---
title: "TCP flow control"
subject: "Computer Networks and Security"
chapter: 5
key: "semester_7/computer_networks_and_security:tcp-flow-control"
source: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/tcp-flow-control
site: BCT Engineering
---

# TCP flow control

Computer Networks and Security · Chapter 5: Transport Layer

- Asked in: 2070 Asar, 4 marks
- Video: [Flow Control in TCP Protocol | Computer Networks](https://www.youtube.com/watch?v=GFD_0-SeCxs) — Engineering Funda
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/tcp-flow-control
- Whole chapter: https://www.bctengineer.com/md/semester_7/computer_networks_and_security/chapter-5

## Question

Explain how flow control is done in TCP.

## Short answer

TCP flow control uses a sliding window governed by the receiver's advertised window (rwnd). The receiver puts its free buffer space in the ACK's window field; the sender limits outstanding bytes to min(rwnd, cwnd). Zero-window probes prevent deadlock, and Clark/Nagle avoid silly window syndrome.

## Answer

**Flow control** stops a fast sender from overwhelming a slow receiver. TCP uses a **sliding window** protocol controlled by the receiver.

#### Mechanism
1. TCP is byte-oriented; each byte has a sequence number.
2. In every ACK, the receiver advertises its **receive window (rwnd)** = free buffer space, in the 16-bit *window size* field.
3. The sender may have at most **min(rwnd, cwnd)** unacknowledged bytes outstanding. cwnd is the congestion window used for congestion control.
4. As the application reads data, the receive buffer empties and a larger window is advertised; the window "slides" forward.
5. If rwnd = 0, the sender stops and sends a small **window probe** periodically, so it does not wait forever if the update is lost.

```text
Sent+ACKed | Sent, not ACKed | Can send | Cannot send
 ...........|<---------- window --------->|
            ^ left edge moves on ACK     ^ right edge moves on rwnd
```

#### Example (receiver buffer 4000 bytes)
| Event | rwnd advertised |
|---|---|
| Connection set up | 4000 |
| Sender sends 3000 bytes, app has not read | 1000 |
| Sender sends 1000 bytes | 0 (sender stops) |
| Application reads 2000 bytes | 2000 (sender resumes) |

#### Silly window syndrome
Tiny windows cause tiny segments. It is avoided by Clark's solution (receiver advertises window only when it can accept at least one MSS or half the buffer) and Nagle's algorithm (sender waits to collect data).

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Who controls TCP flow control and how?
   A. DNS server
   B. Sender, by guessing
   C. Receiver, advertising rwnd in the window size field
   D. Router, via ICMP
   Answer: C. The receiver advertises free buffer space in each ACK. (Key point: Who controls)

2. How much unacknowledged data may the sender have outstanding?
   A. min(rwnd, cwnd)
   B. rwnd + cwnd
   C. Only cwnd
   D. max(rwnd, cwnd)
   Answer: A. The smaller of receiver and congestion windows applies. (Key point: Sender limit)

3. What does the sender do when rwnd = 0?
   A. Continues at full speed
   B. Resets sequence numbers
   C. Closes the connection
   D. Stops and periodically sends window probes
   Answer: D. Probes prevent a deadlock if the window update is lost. (Key point: Zero window)

4. With a 4000-byte buffer, 3000 bytes sent and unread, what is rwnd?
   A. 3000
   B. 0
   C. 1000
   D. 4000
   Answer: C. 4000 - 3000 = 1000 bytes free. (Key point: Example)

## Related in Computer Networks and Security

- [Short note: DLL flow control](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Adll-flow-control) — Computer Networks and Security, chapter 3
- [Tasks done at OSI layers (set 1)](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Aosi-layer-task-mapping-1) — Computer Networks and Security, chapter 1

## Related in other subjects

- [Flow control mechanisms in data communication](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Aflow-control-mechanisms) — Telecommunications, chapter 8
- [Routing, flow control and dynamic routing](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Arouting-flow-control-dynamic) — Telecommunications, chapter 8
- [Flow control in data communication network](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Aflow-control-network) — Telecommunications, chapter 8
- [Labour productivity: causes, measures, control](https://www.bctengineer.com/question.md?key=semester_8%2Fconstruction_management%3Alabour-productivity-control) — Construction Management, chapter 7, asked 5×
