Combination of Flow Control and Error Control
Combination of Flow Control and Error Control
Introduction
In a reliable transport protocol such as TCP, Flow Control and Error Control are not implemented as two completely separate mechanisms. Instead, they are combined using a common data structure called the Sliding Window.
The sliding window uses numbered buffers at both the sender and receiver to achieve two objectives simultaneously:
- Flow Control – Prevents the sender from overwhelming the receiver.
- Error Control – Ensures reliable delivery of packets by using sequence numbers and acknowledgments.
Thus, the same mechanism efficiently handles both reliability and receiver capacity.
Why Combine Flow Control and Error Control?
Earlier, we learned that:
Flow Control Requires
- A buffer at the sender
- A buffer at the receiver
These buffers temporarily store packets until they can be transmitted or processed.
Error Control Requires
- Sequence Numbers
- Acknowledgment Numbers
These help identify
- Lost packets
- Duplicate packets
- Out-of-order packets
Instead of maintaining separate mechanisms, TCP combines both using numbered buffers.
Numbered Buffers
Each buffer location is assigned a sequence number.
These sequence numbers serve two purposes:
- Identify the location of the packet in the buffer.
- Identify the packet during transmission.
Thus, the buffer itself becomes a numbered buffer.
Numbered Buffer at the Sender
At the sender, each free buffer location has a sequence number.
Suppose the next available buffer location is 5.
When a packet is generated,
- It is stored in buffer location 5.
- The packet is assigned Sequence Number = 5.
Sender Buffer +----+----+----+----+----+----+----+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | +----+----+----+----+----+----+----+ ↑ New packet stored Sequence Number = 5
The packet is then transmitted.
However, a copy remains in the sender buffer until an acknowledgment (ACK) is received.
What Happens After ACK Arrives?
Suppose ACK for packet 5 arrives.
Sender Packet 5 Sent ↓ ACK Received ↓ Buffer Location 5 becomes Free
The packet is deleted from the sender buffer.
The free location can now be reused for another packet.
Numbered Buffer at the Receiver
The receiver also maintains a numbered buffer.
Suppose Packet 5 arrives.
Packet Sequence Number = 5
The receiver stores it in
Receiver Buffer Location 5
+----+----+----+----+----+----+----+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | +----+----+----+----+----+----+----+ ↑ Packet 5
The packet remains there until the application layer is ready to receive it.
The receiver then sends
ACK 5
to inform the sender that Packet 5 has arrived successfully.
Working of Combined Flow and Error Control
The complete communication proceeds as follows.
Step 1
Application produces data.
Application ↓ Sender Buffer
Step 2
Packet receives the next sequence number.
Packet Sequence Number = 5
Step 3
Packet is transmitted.
Sender ↓ Network ↓ Receiver
Step 4
A copy remains in the sender buffer.
Sender Buffer Packet 5 Waiting for ACK
Step 5
Receiver stores the packet.
Receiver Buffer Packet 5
Step 6
Receiver sends ACK.
ACK 5
Step 7
Sender receives ACK.
ACK 5 ↓ Delete Packet 5 ↓ Free Buffer Location
Thus,
- The buffer supports flow control.
- The sequence number and acknowledgment support error control.
Sliding Window
What is a Sliding Window?
Since sequence numbers are limited (because only m bits are available), they are used modulo .
Instead of allowing the sender to transmit unlimited packets, only a fixed number of packets are allowed to remain unacknowledged at any time.
This set of packets is called the Sliding Window.
Definition
A Sliding Window is a set of consecutive sequence numbers representing the packets that can be transmitted before receiving acknowledgments.
It is called sliding because the window continuously moves forward as acknowledgments are received.
Sequence Numbers in a Circular Form
If
m = 4
Then
2⁴ = 16
Possible sequence numbers are
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
After 15,
0
comes again.
Therefore sequence numbers are represented as a circle.
0 15 1 14 2 13 3 12 4 11 5 10 6 9 7
8
This represents Modulo-16 numbering.
Example of a Sliding Window
Suppose
- m = 4
- Window Size = 7
Initially
Window 0 1 2 3 4 5 6
These are the packets that can be transmitted.
Sequence Numbers 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |== Window =|
Sending Packets
Suppose packets
0 1 2
are transmitted.
Window 0✓ 1✓ 2✓ 3 4 5 6
The check mark indicates that the packet has been sent but not yet acknowledged.
Buffer Full Condition
If every packet inside the window has been transmitted,
0✓ 1✓ 2✓ 3✓ 4✓ 5✓ 6✓
The sender buffer becomes full.
No new packets can be accepted from the application.
The sender must wait.
ACK Arrives
Suppose ACKs arrive for
0 1 2
These packets are removed.
0 1 2 3✓ 4✓ 5✓ 6✓
Now the beginning of the window becomes empty.
Window Slides
Since packets
0 1 2
have been acknowledged,
the window moves forward.
Old Window 0 1 2 3 4 5 6 New Window 3 4 5 6 7 8 9
Sequence Numbers 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |= Window ==|
Now the sender can transmit
7 8 9
This movement is called Sliding.
Linear Representation of Sliding Window
Although sequence numbers are conceptually circular, most books use a linear representation.
Sequence Numbers 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Window [0][1][2][3][4][5][6]
After ACKs,
Sequence Numbers 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [3][4][5][6][7][8][9]
The linear representation is simply an easier way to visualize the same circular sequence-number space.
How Sliding Window Combines Flow and Error Control
| Feature | Flow Control | Error Control |
|---|---|---|
| Sender Buffer | Limits the number of outstanding packets | Stores packets for possible retransmission |
| Receiver Buffer | Prevents receiver overflow | Stores out-of-order packets |
| Sequence Numbers | Identify buffer locations | Detect lost, duplicate, and out-of-order packets |
| ACKs | Free sender buffer space | Confirm successful packet delivery |
| Sliding Window | Controls how many packets may be sent | Tracks which packets have been acknowledged |
Thus, a single sliding-window mechanism simultaneously:
- Limits the amount of unacknowledged data in transit (flow control).
- Uses sequence numbers and acknowledgments to ensure reliable delivery (error control).
Advantages of the Combined Mechanism
- Implements both flow control and error control with a single mechanism.
- Prevents receiver buffer overflow.
- Detects lost and duplicate packets.
- Supports retransmission of missing packets.
- Maintains packets in the correct order.
- Improves communication efficiency.
- Reduces protocol complexity by using one unified sliding-window system.
Summary
- Flow control requires buffers at the sender and receiver, while error control requires sequence numbers and acknowledgments.
- These requirements are combined by using numbered buffers, where the buffer location also serves as the packet's sequence number.
- At the sender, a transmitted packet remains in the buffer until its acknowledgment is received. At the receiver, an incoming packet is stored in the corresponding buffer location until the application is ready to receive it.
- The Sliding Window mechanism integrates these concepts by allowing only a fixed number of unacknowledged packets to be in transit. As acknowledgments arrive, the window slides forward, freeing buffer space and allowing new packets to be transmitted.
- Consequently, the sliding window provides both flow control and error control, making it one of the most important mechanisms used by reliable transport protocols such as TCP.


Comments
Post a Comment