What is ARQ (Automatic Repeat Request)?

ARQ stands for Automatic Repeat Request also known as Automatic Repeat Query . ARQ is an error-control strategy used in a two-way communication system. It is a group of error-control protocols to achieve reliable data transmission over an unreliable source or service. These protocols reside in the Transport Layer and Data Link Layer of the OSI(Open System Interconnection) model . These protocols are responsible for the automatic retransmission of packets that are found to be corrupted or lost during the transmission process.

Working Principle of Automatic Repeat Request

The main function of these protocols is, that the sender receives an acknowledgment from the receiver end implying that the frame or packet is received correctly before a timeout occurs, timeout is a specific period within which the acknowledgment has to be sent by the receiver to the sender. If a timeout occurs, then the sender does not receive the acknowledgment before the specified time, it is implied that the frame or packet has been corrupt or lost during the transmission. Accordingly, the sender retransmits the packet and these protocols ensure that this process is repeated until the correct packet is transmitted.

ARQ

Applications

ARQ protocols have a wide range of applications as they provide reliable transmissions over unreliable upper sources. These protocols are mainly functional on shortwave radio to ensure reliable delivery of signals. For the same function of ARQ, there are various applications.

Types of ARQ

There are several types of ways in which these protocols function in the data link layer:

Stop And Wait ARQ

Stop and wait ARQ is also referred to as the alternating protocol is a method used in two-way communication systems to send information between two connected devices (sender and a receiver). It is referred to as stop and wait ARQ because the function of this protocol is to send one frame at a time. After sending a frame or packet, the sender doesn’t send any further packets until it receives an acknowledgement from the receiver. Moreover, the sender keeps a copy of the sent packet. After receiving the desired frame, the receiver sends an acknowledgement. If the acknowledgement does not reach the sender before the specified time, known as the timeout, the sender sends the same packet again. The timeout is reset after each frame transmission. The above scenario depicts a Stop and wait situation, so this control mechanism is termed as Stop and wait ARQ.

Go Back-N ARQ

Go-Back-N ARQ is a type of the ARQ protocol, in which the sending process continues to send several frames or packets even without receiving an acknowledgement packet from the receiver . The receiver process keeps track of the sequence number of the next packet it expects to receive and sends that sequence number with every acknowledgement to the sender. The receiver will remove any packet that does not have the desired sequence number it expects and will resend an acknowledgement for the last correct frame. There are only two possibilities that a frame won’t match the sequence number: it is either a duplicated frame of an existing frame or an out-of-order frame that needs to be sent later, the receiver recognizes this scenario and sends an acknowledgement signal accordingly. Once the sender has sent all of the frames in its window, it will identify that all of the frames since the first lost frame, and will go back to the sequence number of the last acknowledgement signal that it received from the receiver pr and continue the process over again. The only drawback of this type of system is that it results in sending packets multiple times: if any frame was lost or found to be corrupted, then that frame and all following frames in the send window will be re-transmitted. This protocol is more efficient than Stop and wait ARQ as there is no waiting time.

Selective Repeat ARQ/Selective Reject ARQ

Selective Repeat ARQ/Selective Reject ARQ protocol mechanism is similar to the Go-Back-N protocol mechanism but in Selective Repeat ARQ the sending process continues even after a frame is found to be corrupt or lost. This is achieved with the receiver process keeps track of the sequence number of the earliest frame it has not received and sends the respective sequence number with the acknowledgement signal. If a frame is not received at the receiver end, the sender continues to send the succeeding frames until it has emptied its window. once this error-correction process has been done, the process continues where it left off. Unlike, Go back-N protocol this does not send a packet multiple times.

What is the Difference Between TCP and ARQ?

TCP (Transmission Control Protocol)

is like a super careful friend. When they get your note, they check every word and send a thumbs-up if everything looks good. If part of the note is missing or smudged, they ask you to resend that part until it’s perfect.

ARQ (Automatic Repeat Request)

is like a friend who just asks you to resend the note if they can’t read it. They don’t check every word as carefully as TCP, but they will ask for another copy if something doesn’t make sense.

TCP (Transmission Control Protocol)

ARQ (Automatic Repeat Request)

Layer

Transport Layer and Data Link Layer

Functionality

Comprehensive protocol including error detection, correction, flow control, and congestion control

Primarily focuses on error detection and correction

Mechanism

Uses a combination of ARQ mechanisms ( Stop and Wait , Go-Back-N , Selective Repeat ) along with flow and congestion control

Uses specific ARQ mechanisms such as Stop and Wait, Go-Back-N, and Selective Repeat

Flow Control

Incorporates flow control mechanisms to prevent sender from overwhelming the receiver

Does not inherently include flow control mechanisms

Congestion Control

Includes congestion control algorithms to manage network traffic and avoid congestion

Does not inherently include congestion control

Sequence Numbering

Uses sequence numbers for packets to ensure correct order and detect duplicates

Sequence numbers are used in ARQ protocols to keep track of frames and retransmissions

Reliability

Ensures reliable delivery of data through acknowledgments, retransmissions, and sequence numbering

Ensures reliable delivery through retransmissions upon detecting errors or losses

Error Handling

Uses checksums, sequence numbers, and acknowledgments for error detection and correction

Uses acknowledgments and timeouts to detect errors and retransmit corrupted or lost frames

Use Cases

Widely used in internet communications, such as web browsing, email, and file transfers

Used in various communication systems, including shortwave radio and modem protocols

Advantages of ARQ

Disadvantages of ARQ

Conclusion

Whether you’re testing a program or sending messages, it’s important to make sure everything works just right. Test doubles like stubs and mocks help programmers test parts of their code, while protocols like TCP and ARQ help ensure that messages get through without mistakes. Knowing when to use these tools can make things run smoothly.

Frequently Asked Questions on Automatic Repeat Request – FAQs

What’s a test double?

A test double is like a stand-in for a part of a program that isn’t ready yet, helping you test the program without needing the real part.

How is TCP different from ARQ?

TCP checks every part of a message to make sure it’s perfect, while ARQ just asks for a resend if something is wrong.

When would I use a stub instead of a mock?

Use a stub when you just need basic answers in a test, and a mock when you need to check how different parts of the program work together.

Why do we need TCP and ARQ?

Both TCP and ARQ help make sure messages are sent correctly, but TCP is more careful, while ARQ is simpler and faster.