# Stop and Wait ARQ Protocol Tutorial With Example

In the last tutorial, we have studied about the various delays in computer networks. In this tutorial, we will study about the first method of flow control i.e. Stop and wait ARQ.

Sometimes, the speeds of the sender and the receiver might be different and thus to send data without any hindrance or data loss we need Flow control methods.

## Stop and Wait ARQ

It is the simplest protocol to implement.

Below picture shows how it works –

Stop And Wait ARQ

As the above image depicts,
– Packets are sent one by one. After one packet is processed the receiver would send acknowledgement and request for next packet.
– The sender sends one packet and stop and wait for another packet to send until receiver requests for another packet.
– Once the data reaches the receiver, the sequence no of the data is compared with receiver’s sliding window no. If there is a match, data is accepted or else it is discarded.
– The acknowledgement no. will always be the sequence no of the next expected data, then only acknowledgement is accepted or else it is discarded.

###### Efficiency –

Efficiency = ${ \frac {useful time}{total cycle time} }$
= ${ \frac {1}{1+2a}}$
where a = $( \frac {TP}{TT} )$

### Disadvantages of Stop and Wait

– Efficiency of Stop and Wait protocol is really less.

Now that we know about Stop and Wait ARQ, we have some questions for you –

### Practice Questions

###### Question 1

Assume using stop and wait protocol, we wish to send 10 packets from source to destination and every 4th packet is lost. How many packets needs to be sent?

Solution –
Order in which packets are sent –
1 2 3 4 4 5 6 7 7 8 9 10 10

Total no of packets transmitted = 13
Packet nos retransmitted = 4, 7, 10

###### Question 2

Assume a channel having error probability.
Error probability = 20%
Total no of packets sent on list = 400

What is the total no of packets to be transmitted to send all 400 packets?

Solution –
Total no. of packets to be transmitted =
400 + 400*0.2 +80*0.2 ……. = 500

Again, 20% packets will be retransmitted

Note:
If n packets are sent and error probability is p, then,
Total packets to be retransmitted = ${ n * { \frac {1}{1-p}}$

That was all about Stop and wait ARQ. In next tutorial, we will study about Go back N and selective repeat flow control methods.

[latexpage]