# Stop-and-Wait Protocol
## What is Stop-and-Wait
Stop-and-wait is the simplest flow control and error control protocol used in data communications. In this protocol, the sender transmits a single frame and then stops transmission and waits for an acknowledgment from the receiver before sending the next frame. Only one frame is ever outstanding at any time. If the receiver receives the frame correctly, it sends a positive acknowledgment. If the frame arrives with errors detected by the CRC or checksum, the receiver discards the frame and may send a negative acknowledgment or simply not respond. If the sender does not receive an acknowledgment within a timeout period, it retransmits the frame.
## How Stop-and-Wait Works
The sender transmits frame number 0 and starts a timer. The receiver checks the frame for errors. If no errors are found, the receiver sends an acknowledgment for frame 0 and is ready to receive frame 1. When the sender receives the acknowledgment, it stops the timer and transmits frame 1. If the timer expires before an acknowledgment is received, the sender assumes the frame or its acknowledgment was lost and retransmits frame 0. Frames and acknowledgments are alternately numbered 0 and 1 to distinguish between new frames and retransmissions.
## Efficiency of Stop-and-Wait
Stop-and-wait is simple but very inefficient, especially when the propagation delay is large. The efficiency is determined by the fraction of time the sender spends actually transmitting data. If the sender takes time T to transmit a frame and time 2P for the acknowledgment to make a round trip, the efficiency is T divided by T plus 2P. When propagation delay is much larger than transmission time, most time is wasted waiting. For a satellite link with 270 milliseconds of one-way delay and a 1 Mbps link transmitting a 1000-byte frame, the efficiency is extremely low because the transmission time is only 8 milliseconds while the round-trip time is 540 milliseconds.
## Use Cases
Stop-and-wait is used in situations where simplicity is more important than efficiency, the propagation delay is very short relative to transmission time, the network has very high error rates where going-back to retransmit many frames would be more wasteful, or the implementation resources are severely limited. In practice, most modern protocols use sliding window protocols instead of stop-and-wait because of the efficiency advantage.Back to Subject