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.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Difference between Stop and Wait protocol and Sliding Window protocol
- Efficiency of Stop and Wait Protocol
- Stop and Wait ARQ
- Difference between Stop and Wait, GoBackN and Selective Repeat
- Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)
- Difference between Serial Line Internet Protocol (SLIP) and Point-to-Point Protocol (PPP)
- Difference between File Transfer Protocol (FTP) and Secure File Transfer Protocol (SFTP)
- Stop Wi-Fi from stealing
- Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP) in Data Link Layer
- Different types of recurrence relations and their solutions
- Previous Year Gate CSE/IT papers with solutions
- TACACS+ Protocol
- RADIUS Protocol
- Wireless Application Protocol
- Two Phase Locking Protocol
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.