Signup/Sign In

Understanding the Basics of STOP & WAIT and STOP & WAIT ARQ Protocol

Posted in Internet Security   LAST UPDATED: MAY 29, 2023

    Flow control in computer networks is defined as the process of managing the rate of data transmission between two systems(nodes), this mechanism ensures that the rate of data (transmitted by the sender) is within the receiving capacity of the receiver node.

    flow control protocols - Stop & wait and Stop & Wait ARQ

    In the above diagram, we can see that there are two protocols, Stop & Wait and a sliding window. The basic difference between them is that, in stop & wait the sender node sends one frame and then waits for the feedback from the receiver node. On the other hand, in the sliding window protocol, the sender node keeps on sending frames to the receiver node without waiting for any feedback and it re-sends the frame which is/are damaged or suspected.

    Talking about efficiency, the efficiency of the stop &wait protocol is less, while the efficiency of the sliding window protocol is more than the stop & wait protocol. And, in stop & wait protocol sorting is not necessary, but in sliding window protocol, sorting may or may not be necessary. The stop & wait protocol is half-duplex whereas the sliding window protocol is full-duplex.


    Stop & Wait Protocol

    The Stop and Wait protocol is a simple flow control mechanism used in computer networks. In this protocol, the sender transmits a single data frame and waits for an acknowledgment from the receiver before sending the next frame. The receiver acknowledges the receipt of each frame, allowing for reliable and sequential data transmission. This protocol ensures that data is delivered successfully, but it can be inefficient for high-latency networks as it introduces delays during the waiting period.

    How Stop & Wait Works

    1. The sender node sends a data packet to the receiver node.

    2. Then, waits for the feedback of the transmitted packet.

    3. As soon as the receiver node receives a data packet it starts processing it.

    4. Then, the receiver node sends the feedback to the sender node (about the received data packet).

    5. After receiving the feedback, if the feedback is positive then the sender node sends the next data packet otherwise resends the damaged packet.

    Stop & Wait protocol for flow control in computer network

    Stop & Wait Protocol performs better for LANs than WANs because the efficiency of the protocol is inversely proportional to the distance between the sender & receiver node and as we all know that the distance is less in LANs as compared to WANs.

    But this protocol has some issues, one such issue is the probability of occurrence of deadlock, which is very high due to loss in a data packet or loss in feedback which can lead to infinite waiting, where the sender will keep on sending the data packet if the feedback is lost.

    Stop & Wait ARQ

    Stop & Wait ARQ is a sliding window protocol for flow control and it overcomes the limitations of Stop & Wait, we can say that it is the improved or modified version of the Stop & Wait protocol.

    Stop & Wait ARQ assumes that the communication channel is noisy (previously Stop & Wait assumed that the communication channel is not noisy). Stop & Wait ARQ also assumes that errors may occur in the data while transmission.

    Working of Stop & Wait for ARQ

    Working of Stop & Wait ARQ is almost like Stop & Wait protocol, the only difference is that it includes some additional components, which are:

    1. Time out timer

    2. Sequence numbers for data packets

    3. Sequence numbers for feedback

    Note: If any sliding window protocol must work properly then, the available sequence numbers must be greater than or equal to the sum of the sender window size and receiver window size.

    [available sequence numbers >= sender window size + receiver window size]

    Stop & Wait ARQ is a 1-bit sliding window protocol where the size of the sender window as well as the receiver window is 1. Thus, in Stop & Wait ARQ technique, the minimum number of sequence numbers required is equal to the sum of the sender window size & receiver window size

    [minimum number of sequence numbers required = sender window size + receiver window size]

    Thus, the minimum number of sequence numbers required in Stop & Wait ARQ is 2, which are 0 and 1.

    Stop & Wait ARQ overcoming the problem of a lost data packet

    For solving this problem, we use a time-out timer, after transmitting the data packet to the receiver through the communication channel, the sender starts the time-out timer. Now if the data packet's feedback is received by the sender before the timer expires, then the sender stops the timer and transmits the next data packet.

    And if the time-out timer expires and the feedback is not received by the sender then, the sender retransmits the data packet. This prevents the occurrence of deadlock in the network.

    An illustration of the process is shown in the image below.

    Stop & Wait ARQ protocol for flow control in computer network


    The problem of lost Feedback

    The problem of delayed/lost feedback(which used to happen in the Stop & Wait protocol) is solved by putting sequence numbers on data packets.

    Assume that the feedback given by the receiver is lost, then the sender resends the same data packet after its timer expires. This prevents the occurrence of deadlock. The sequence number on the data packets helps the receiver to identify the duplicate data packet, then the receiver discards the duplicate data packet & resends the same feedback.

    We can see the process in the image below

    non deadlock in Stop & Wait ARQ flow control protocol

    Now in the case of feedback delay, we can see in the image below

    Stop & Wait handling the feedback delay from receiver


    The problem of a damaged data packet

    When it comes to data transmission in computer networks, one of the common challenges is the possibility of encountering damaged or corrupted data packets. This issue becomes particularly relevant when discussing flow control protocols like STOP & WAIT and STOP & WAIT ARQ (Automatic Repeat Request).

    Imagine a scenario where a sender is transmitting a series of data packets to a receiver using the STOP & WAIT protocol. Each packet contains valuable information that needs to be accurately delivered. However, during transmission, a data packet becomes damaged due to noise, interference, or other factors present in the network.

    In the basic STOP & WAIT protocol, without any error detection or retransmission mechanism, the receiver would be unaware of the damaged packet. The receiver would provide an acknowledgment to the sender, assuming the data was received correctly. As a result, the damaged packet remains undetected, leading to potential errors or inaccuracies in the received data.

    This is where the enhanced STOP & WAIT ARQ protocol comes into play. Incorporating an acknowledgment mechanism and error detection capabilities, it allows the receiver to identify the damaged packet and request the sender to retransmit it. The sender, upon receiving this request, resends the packet, ensuring that the receiver obtains the correct data.

    The inclusion of error detection and retransmission mechanisms in the STOP & WAIT ARQ protocol addresses the problem of damaged data packets. It provides a more robust and reliable approach to data transmission, as it actively detects and corrects errors, ensuring the accuracy and integrity of the received data.

    Difference Between Stop & Wait and Stop & Wait ARQ

    Here's a table comparing the Stop & Wait protocol and the Stop & Wait ARQ (Automatic Repeat Request) protocol:

    Stop & Wait Protocol Stop & Wait ARQ Protocol
    Error Detection No error detection mechanism Incorporates error detection mechanism
    Retransmission No retransmission of lost or corrupted frames Retransmits lost or corrupted frames
    Efficiency Less efficient due to waiting periods More efficient due to error recovery capabilities
    Data Integrity No assurance of data integrity Ensures data integrity through error detection
    Latency Can introduce significant delays Can minimize delays through error recovery
    Suitable for Simple networks with low error rates Networks with potential packet loss or errors
    Reliability Basic reliability for data transmission Improved reliability through error recovery

    Conclusion

    In the world of networking and communication protocols, the STOP & WAIT and STOP & WAIT ARQ (Automatic Repeat Request) protocols play a significant role in ensuring reliable data transmission. These flow control mechanisms are designed to regulate the exchange of data between a sender and receiver, preventing overwhelming the recipient and ensuring data integrity.

    The STOP & WAIT protocol involves the sender transmitting a single data frame and waiting for an acknowledgment from the receiver before sending the next frame. This process ensures that the receiver successfully receives and processes each frame individually. On the other hand, the STOP & WAIT ARQ protocol incorporates an acknowledgment mechanism that allows for error detection and retransmission of lost or corrupted frames.

    Understanding these flow control protocols is essential for network engineers and developers working on reliable data transmission systems. By implementing these protocols effectively, they can enhance the efficiency, accuracy, and robustness of data transmission in various communication networks.

    FAQs

    1. What is the purpose of flow control protocols like STOP & WAIT?

    Flow control protocols like STOP & WAIT regulate the rate of data transmission between a sender and receiver to prevent overwhelming the recipient and ensure reliable delivery.

    2. How does the STOP & WAIT protocol work?

    In the STOP & WAIT protocol, the sender transmits a single data frame and waits for an acknowledgment from the receiver before sending the next frame.

    3. What is the advantage of using the STOP & WAIT ARQ protocol over the basic STOP & WAIT protocol?

    The STOP & WAIT ARQ protocol incorporates an acknowledgment mechanism and enables error detection and retransmission of lost or corrupted frames, resulting in improved reliability.

    4. Can the STOP & WAIT protocol handle packet loss or errors?

    The basic STOP & WAIT protocol does not have error detection or retransmission capabilities. However, the STOP & WAIT ARQ protocol addresses these issues by employing an acknowledgment mechanism and error recovery techniques.

    5. In what scenarios are STOP & WAIT and STOP & WAIT ARQ protocols commonly used?

    These protocols are commonly used in scenarios where reliable data transmission is crucial, such as point-to-point communication links, low-bandwidth networks, or systems with high error rates.

    You may also like:

    About the author:
    Shashwat Pandey is an accomplished technical author with a wealth of experience in writing about computer networks. His passion for the subject extends beyond his writing, and he enjoys exploring new networking technologies to stay on the trend.
    Tags:computer-network
    IF YOU LIKE IT, THEN SHARE IT
     

    RELATED POSTS