It is the simplest flow control method in which the sender will send the packet and then wait for the acknowledgement by the receiver that it has received the packet then it will send the next packet.
Stop and wait protocol is very easy to implement.
Total time taken to send is,
Ttotal = Tt(data) + Tp + Tq + Tprocess + Tt(ack) + Tp ( since, Tq and Tprocess = 0) Ttotal = Tt(data) + 2Tp + Tt(ack) Ttotal = Tt(data) + 2Tp (when Tt(ack) is negligible)
Efficiency = useful time / total cycle time = Tt / (Tt+2Tp) = 1 / (1+2a) [a = Tp/Tt]
Note: Stop and wait is better for less distance. Hence it is a good protocol for LAN. Stop and wait is favorable for bigger packets.
What if the data packet is lost in between ?
- According to sender, receiver is busy but actually data is lost.
- Receiver will assume, no packet has been sent by sender.
- Both will be waiting for each other and there will be a deadlock.
Need for timeout timer:
A timer is applied and the receiver will wait till the timeout timer for the data after that it will confirm that the data has been lost.
What if the data packet has been lost ?
After timeout timer expires, sender will assume that the data is lost but actually the acknowledgment is lost. By assuming this it will send the data packet again but according to receiver it is a new data packet, hence it will give rise to duplicate packet problem.
To eliminate duplicate packet problem sequence number is added to the data packet. So using packet numbers it can easily determine the duplicate packets.
What if there is a delay in receiving acknowledgement ?
According to sender, the acknowledgement of packet 1 is delayed and packet 2 has been lost. But the receiver assumes that the acknowledgement that has been received was of packet 2. This problem is called missing packet problem.
Missing packet problem can be solved if acknowledgements also have numbers.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Difference between Stop and Wait protocol and Sliding Window protocol
- Efficiency of Stop and Wait Protocol
- Difference between Stop and Wait, GoBackN and Selective Repeat
- Stop and Wait ARQ
- Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)
- Difference between File Transfer Protocol (FTP) and Secure File Transfer Protocol (SFTP)
- Difference between Serial Line Internet Protocol (SLIP) and Point-to-Point Protocol (PPP)
- Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP) in Data Link Layer
- Difference between Border Gateway Protocol (BGP) and Routing Information Protocol (RIP)
- Introduction of Virtual Router Redundancy Protocol (VRRP) and its configuration
- Stop Wi-Fi from stealing
- Encryption, Its Algorithms And Its Future
- Decidable and Undecidable problems in Theory of Computation
- Computable and non-computable problems in TOC
- Applications of Ad hoc network and it's problems
- Difference Between Go-Back-N and Selective Repeat Protocol
- Difference Between High-level Data Link Control (HDLC) and Point-to-Point Protocol (PPP)
- Difference between Stateless and Stateful Protocol
- Difference between Virtual Private Network (VPN) and Multi-Protocol Label Switching (MPLS)
- Main difference between Timestamp protocol and Thomos write rule in DBMS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.