codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Subjects
🌐

Computer Networks

26 chapters

1Network Topologies & LAN/WAN2Network Devices (Hub, Switch, Router)3OSI Reference Model4OSI Model & TCP/IP Suite5TCP/IP Protocol Suite6Switching Techniques (Circuit, Packet)7Data Link: Framing & Error Detection8Error Correction (Hamming Code)9Flow Control (Stop-and-Wait, Sliding Window)10MAC: CSMA/CD & CSMA/CA11Network Layer & Routing12IP Addressing (IPv4, IPv6)13Subnetting & CIDR14Routing Algorithms (Distance Vector, Link State)15ARP, ICMP, and NAT16DHCP Protocol17Transport Layer Services18Transport Layer: UDP19Transport Layer: TCP & 3-Way Handshake20TCP Congestion Control21Application Layer: DNS & HTTP22Application Layer: SMTP & FTP23Socket Programming Basics24Wireless Networks & Wi-Fi Standards25VLANs & Spanning Tree Protocol26Network Security & Cryptography
SubjectsComputer Networks

Flow Control (Stop-and-Wait, Sliding Window)

Updated 2026-05-02
2 min read

Flow Control (Stop-and-Wait, Sliding Window)

Flow Control ensures that a fast sender does not overwhelm a slow receiver. The receiver must have time to process each frame before the next one arrives.

1. Stop-and-Wait Protocol

The simplest flow control mechanism. The sender sends one frame and then stops and waits for an acknowledgment (ACK) from the receiver before sending the next frame.

  • Pros: Dead simple. No buffer overflow possible.
  • Cons: Extremely inefficient. The sender is idle for the entire round-trip time (RTT). On a high-latency, high-bandwidth link, utilization can be less than 1%.

Utilization: U = T_frame / (T_frame + 2 × T_propagation)

2. Go-Back-N (GBN)

The sender can send up to $N$ frames (the window size) without waiting for an ACK. The receiver only accepts frames in order.

  • If frame 3 is lost, the receiver discards frames 4, 5, 6 (even if they arrive correctly) and sends a NAK or duplicate ACK for frame 3.
  • The sender must retransmit frame 3 AND all subsequent frames (4, 5, 6). Hence "Go Back N."
  • Pros: Much better utilization than Stop-and-Wait.
  • Cons: Wasteful retransmission of correctly received frames.

3. Selective Repeat (SR)

Like GBN, the sender can send up to $N$ frames ahead. But the receiver buffers out-of-order frames and only requests retransmission of the specific lost/corrupted frames.

  • If frame 3 is lost, the receiver accepts and buffers frames 4, 5, 6. It sends a NAK only for frame 3.
  • The sender retransmits ONLY frame 3. When it arrives, the receiver delivers frames 3, 4, 5, 6 in order.
  • Pros: Maximum efficiency. Only lost frames are retransmitted.
  • Cons: Requires buffer space at the receiver. More complex to implement.

4. Comparison

FeatureStop-and-WaitGo-Back-NSelective Repeat
Window Size1NN
RetransmissionSingle frameN framesOnly lost frame
Receiver Buffer1 frame1 frameN frames
EfficiencyVery LowModerateHigh


PreviousError Correction (Hamming Code)NextMAC: CSMA/CD & CSMA/CA

Recommended Gear

Error Correction (Hamming Code)MAC: CSMA/CD & CSMA/CA