Stop and Wait ARQ

Learn via video courses
Topics Covered

Overview

The stop and wait ARQ is one of the Sliding Window Protocol strategies that is used where reliable ordered delivery of the data frames is required. The stop and wait ARQ is used for noisy channels or links and it manages the flow and error control between the sender and the receiver. The stop and wait ARQ protocol sends a data frame and then waits for an acknowledgment or ACK from the receiver. The ACK means that the receiver has successfully received the data frame. After the sender receives the ACK from the receiver, it sends the next data frame. So, there is a wait and then the next data frame is transmitted so the name came to be Stop and Wait ARQ protocol. In the stop and wait ARQ, both the sender and the receiver have windows of the same size i.e. 1.

What is Stop and Wait for ARQ (Automatic Repeat Request)?

Now, let us discuss the data link layer briefly so that we can get a better understanding of the Stop and Wait ARQ protocol as it is one of the most widely used protocols of the data link layer to control errors.

The data link is the second layer of the OSI model which is used for the transmission of the error-free frames from one node to the other node. If the two computer nodes are on the same network then the data link layer provides a connection between the two nodes. The main work of the data link layer is to convert the data into the form of frames.

The flow control protocols involved in the data link layers are as follows:

 What is Stop and Wait for ARQ

Now, let us get back to the topic of Stop and Wait ARQ. The stop and wait ARQ is one of the Sliding Window Protocol strategies that is used where reliable in-order delivery of the data frames is required. The stop and wait ARQ is used for noisy channels or links and it manages the flow and error control between the sender and the receiver.

The stop and wait ARQ protocol sends a data frame and then waits for an acknowledgment or ACK from the receiver. The ACK means that the receiver has successfully received the data frame. After the sender receives the ACK from the receiver, it sends the next data frame. So, there is a wait and then the next data frame is transmitted so the name came Stop and Wait ARQ protocol.

In the stop and wait ARQ protocol, ARQ stands for Automatic Repeat Request. ARQ is an error-control strategy that ensures that a sequence of information is delivered in order and without any error or duplications despite transmission errors and losses.

In the stop and wait ARQ, the sender also keeps a copy of the currently sending frame so that if the receiver does not receive the frame then it can retransmit it. In stop and wait ARQ, the sender sets a timer for each frame so whenever the timer is over and the sender has not received any acknowledgment for the frame, then the sender knows that the particular frame is either lost or damaged. So, the sender sends back the lost or damaged frame once the timer is out. So, we can see that the sender needs to wait for the timer to expire before retransmission

There is no negative acknowledgment of the lost or damaged frames. So, there is no NACK (negative acknowledgment) in case of stop and wait ARQ.

Let us learn the working of the stop and wait ARQ using an example in the next section.

Working Principle of Stop and Wait ARQ

Before learning about the working of the stop and wait ARQ, we should be familiar with the window size of the sender and receiver as the stop and wait ARQ is a type of sliding window protocol only.

In the stop and wait ARQ, both the sender and the receiver have windows of the same size. The window on the sender's side covers the sequence of data packets that are sent (or to be sent). On the other hand, the window on the receiver's side covers the sequence of data packets that are received (or to be received).

The size of the sender's window is 1. The window size of the receiver is the same as that of the sender i.e. 1. The sender's window size is represented using Ws and the receiver's window size is represented using Wr.

The overall working of the stop and wait ARQ is simple. Initially, the sender sends one frame as the window size is 1. The receiver on the other end receives the frame and sends the ACK for the correctly received frame. The sender waits for the ACK until the timer expires. If the sender does not receive the ACK within the timer limit, it re-transmits the frame for which the ACK has not been received.

Now, let us take an example to visualize the working of stop and wait ARQ or how the data frame is transmitted using the stop and wait ARQ protocol. The image below shows the transmission of frames.

 Working principle of Stop and Wait ARQ

The steps of data transmission can be:

  1. The sender sends frame 0.
  2. The sender waits for ACK from the receiver.
  3. The receiver receives the frame and sends back ACK 0.
  4. Again the sender sends the frame 1 and this process is continued till all the frames have been received by the receiver.

Let us discuss the various problems of the Stop and Wait ARQ -

  1. Problem of Lost Data Packet When the sender sends the data packet and the receiver does not receive the data packet, it means that the data is lost in between the transmission. So, to overcome this type of problem, the sender uses a timer. When the sender sends the data packet, it starts a timer. If the timer goes off before receiving the acknowledgment from the receiver, the sender retransmits the same data packet. Refer to the image below for better visualization.

Problem of Lost Data Packet

  1. Problem of Lost Acknowledgement When the sender sends the data packet and the receiver receives the data packet but the acknowledgment from the receiver is not received. It means that the acknowledgment is lost in between the transmission. So, to overcome this type of problem, the sender uses sequence numbering. When the sender sends the data packet, it attaches a certain sequence number which helps the receiver identify the data packet. If the timer goes off before receiving the acknowledgment from the receiver, the sender retransmits the same data packet. But in this case, the receiver already has the data packet, so it discards the data and sends it back an acknowledgment. This tells the sender that the certain data packet is now received correctly.

Refer to the image below for better visualization.

Problem of Lost Acknowledgement

  1. Problem of Delayed Acknowledgement When the sender sends the data packet and the receiver receives the data packet but the acknowledgment from the receiver is not received. It means that the acknowledgment is lost or delayed in between the transmission. So, to overcome this type of problem, the sender uses sequence numbering. When the sender sends the data packet, it attaches a certain sequence number which helps the receiver identify the data packet. If the timer goes off before receiving the acknowledgment from the receiver, the sender retransmits the same data packet. But in this case, the receiver already has the data packet, so it discards the data and sends it back the acknowledgment again. Now, if the sender has received the previously sent acknowledgment then the newer acknowledgment is discarded by the sender. Refer to the image below for better visualization.

Problem of Delayed Acknowledgement

  1. Problem of Damaged Packet When the sender sends the data packet and the receiver receives the data packet the received data packet is corrupted. So, to overcome this type of problem, the receiver uses negative acknowledgment (NACK). So, if the sender receives a negative acknowledgment then the sender retransmits the data packet.

Refer to the image below for better visualization.

Problem of Damaged Packet

Characteristics of Stop and Wait ARQ

Let us discuss some of the important characteristics of the stop and wait ARQ.

  • The stop and wait ARD is a sliding window protocol with a window size equal to 1.
  • The stop and wait ARQ is an example of the Closed Loop OR connection-oriented.
  • The sender sends the data frame with a sequence number.
  • The sender also maintains a copy of the data frame that is being currently sent so that if the ACK is not received then the sender can re-transmit the frame.
  • The sender can send only one frame at a time and the receiver can also receive only one frame at a time.
  • The stop and wait ARQ is a connection-oriented protocol.
  • In the stop and wait ARQ, the sender needs to maintain a time tracker.

Advantages of Stop and Wait ARQ

Let us discuss some of the advantages of the stop and wait ARQ.

  • The stop and wait ARQ can be used in both the data link layer and the transport layer.
  • The stop and wait ARQ provides both error management and flow control management.
  • The stop and wait ARQ works in half-duplex mode as at a time only the sender can send the message or the receiver can send the ACK.
  • The stop and wait ARQ ensures that the information is received by the receiver in the order it was sent.

Limitations of Stop and Wait ARQ

Let us discuss some of the limitations or disadvantages of the stop and wait ARQ.

  • The data can be lost in between the transmission. So, in such a case, the sender waits for ACK and the receiver waits for the data frame for an infinite amount of time.
  • The ACK from the receiver may get lost in the channel. So, the sender waits for ACK for an infinite amount of time.
  • The window size of the sender and the receiver is only 1. So, only one frame can be sent at a time.
  • As there is a timer concept, the sender must wait for a long duration before retransmission. Hence, the stop and wait ARQ is a slow protocol.

Conclusion

  • The stop and wait ARQ is one of the Sliding Window Protocol strategies that is used where reliable in-order delivery of the data frames is required.
  • The stop and wait ARQ is used for noisy channels or links and it manages the flow and error control between the sender and the receiver.
  • The stop and wait ARQ protocol sends a data frame and then waits for an acknowledgment or ACK from the receiver. The ACK means that the receiver has successfully received the data frame.
  • After the sender receives the ACK from the receiver, it sends the next data frame. So, there is a wait and then the next data frame is transmitted so the name came Stop and Wait ARQ protocol.
  • The sender can send only one frame at a time and the receiver can also receive only one frame at a time.
  • The sender also maintains a copy of the data frame that is being currently sent so that if the ACK is not received then the sender can re-transmit the frame.
  • In the stop and wait ARQ, both the sender and the receiver have windows of the same size i.e. 1.
  • The stop and wait ARQ can be used in both the data link layer and the transport layer and it provides both error management and flow control management.
  • The data can be lost in between the transmission. So, in such a case, the sender waits for ACK and the receiver waits for the data frame for an infinite amount of time.
  • The ACK from the receiver may get lost in the channel. So, the sender waits for ACK for an infinite amount of time.