3/8
Network Sliding Window Protocol Β· Page 1 of 1

TCP/IP Sliding Window

Network Sliding Window

The Problem

Sending data over networks:

  • Packets can be lost
  • Need confirmation
  • Want efficiency

Naive approach:

Send packet 1 β†’ Wait for ACK β†’ Send packet 2 β†’ Wait...
Only 1 packet in flight!

Inefficient: Network latency wastes time

The Sliding Window Solution

Send window of packets without waiting:
Send: 1, 2, 3, 4, 5 (all without waiting)
Receive ACKs: 1, 2, 3, 4, 5
Slide window: Now can send 6, 7, 8, 9, 10

Benefits:

  • Multiple packets in flight
  • Better bandwidth utilization
  • Handles packet loss gracefully

TCP Window Structure

Sent & ACKed | Sent & Pending ACK | Can Send | Cannot Send
────────────┼──────────────────┼──────────┼─────────────
1, 2, 3, 4  | 5, 6, 7, 8       | 9-12     | 13+

Window size = 4 packets

Flow Control

Receiver can advertise window size:

Receiver: "Send only 5 packets at a time"
(I can't process more than 5)

Sender respects receiver's capacity
Prevents overwhelming receiver!

Congestion Control

Adjust window based on network conditions:

Healthy: window size = 10
Packet loss detected: window size = 5
No loss for time T: window size = 15

Algorithms: TCP Reno, CUBIC, BBR

Sequence Numbers

Packet header includes:
- Sequence number (where in stream)
- Acknowledge number (up to what received)
- Window size (how much more can send)

Receiver: "Got up to byte 5000, window 2000"
Sender: "Can send bytes 5001-7000"
main.py
Loading...
OUTPUT
β–ΆClick "Run Code" to execute…