1. Overview
In this tutorial, we’ll discuss a protocol used for the reliable delivery of data packets in networks: Selective Repeat Protocol (SRP). Furthermore, we’ll present an example of packet transmission using the SRP.
Finally, we’ll highlight some crucial advantages and disadvantages of this protocol.
2. Introduction
Selective Repeat Protocol (SRP) is a type of error control protocol we use in computer networks to ensure the reliable delivery of data packets. Additionally, we use it in conjunction with the Transmission Control Protocol (TCP) to ensure that the receiver receives data transmitted over the network without errors.
In the SRP, the sender divides the data into packets and sends them to the receiver. Furthermore, the receiver sends an acknowledgment (ACK) for each packet received successfully. If the sender doesn’t receive an ACK for a particular packet, it retransmits only that packet instead of the entire set of packets.
The SRP uses a window-based flow control mechanism to ensure the sender doesn’t overwhelm the receiver with too many packets. Additionally, the sender and receiver maintain a window of packets. Based on the window size, the sender sends packets and waits for a specific amount of time for acknowledgment from the receiver.
The receiver, in turn, maintains a window of packets that contains the frame number it’s receiving from the sender. If a frame is lost during transmission, the receiver sends the sender a negative acknowledgment attacking the frame number.
3. Steps
Now let’s discuss the steps involved in the SRP.
The first step is to divide data into packets. The sender divides the data into packets of a fixed size. When the sender divides the data into packets, it assigns a unique sequence number to each packet. The numbering of packets plays a crucial role in the SRP.
The next step is to send the packets to the receiver. The receiver receives the packets and sends an acknowledgment (ACK) for each packet received successfully.
The sender and receiver maintain a window of packets indicating the number of frames we can transmit or receive at a given time. Additionally, we determine the size of the window based on the network conditions. As the sender sends packets, it updates its window to reflect the packets that have been transmitted, and the ACKs received.
However, if the sender doesn’t receive an ACK for a particular packet within a certain timeout period, it retransmits only that packet instead of the entire set of packets. The receiver only accepts packets that are within its window. If the receiver receives a packet outside the window, it discards the packet.
The receiver sends selective acknowledgments (SACKs) for packets received out of order or lost. The sender processes the SACKs to determine which packets need to be retransmitted.
Finally, we continue this process until we successfully send the data packets or the number of retransmissions exceeds a predetermined threshold.
4. Example
Let’s see how we can transmit data using the SRP. We divide our sample data into 6 data packets or frames:
Additionally, we’re assuming the window size for the receiver and sender is 2. Hence, we transmit two frames and wait for the receiver to acknowledge the frames transmitted before sending the next frames. In case of a missing or unacknowledged frame, we need to resend it before proceeding with the next set of frames.
4.1. No Error in Transmission
Let’s start sending the packets using the SRP. We send the first two frames to the receiver and wait for the acknowledgment:
As we can see, the receiver successfully received and acknowledged the first two data frames. One crucial point is that when the sender sends a frame, it waits for a specific time to get a response. In this case, we receive responses from the receiver within the waiting time of each frame. Hence, we move on to the next 2 data frames.
4.2. Frame Is Lost
Let’s discuss a scenario when a frame is lost during the transmission:
Here, frame 2 is lost during the transmission. Hence, the sender waits for a specific amount of time to get a response from the receiver. In this case, we received a negative acknowledgment for frame 2. Therefore, we need to resend frame 2 before we proceed further:
4.3. Acknowledgment Is Lost
Let’s take a look at another situation when the acknowledgment of a frame is lost during transmission:
In this case, the receiver successfully receives frames 4 and 5, but the acknowledgment of frame 5 is lost. Hence, the sender waits for a specific amount of time in order to receive an acknowledgment for frame 5. After the waiting time is over, the sender sends frame 4 again:
5. Advantages and Disadvantages
The SRP offers several advantages over other error control protocols, including efficient retransmission, selective acknowledgments, reduced delay, and higher throughput.
The main difference with other error control protocols is that it only retransmits lost packets rather than retransmitting the entire set of packets. As a result, the SRP reduces unnecessary network traffic and improves efficiency.
In the SRP, the receiver sends selective acknowledgments (SACKs) for packets received out of order or lost. This allows the sender to know exactly which packets need to be retransmitted.
Furthermore, the SRP can reduce delay since the receiver can immediately start processing the received packets, even if some packets are still missing.
Finally, the SRP can achieve higher throughput compared to other protocols like Go-Back-N, especially when the network has a high error rate or high bandwidth-delay product.
Despite its advantages, the SRP also has some limitations and disadvantages.
It’s more complex compared to other error control protocols. Therefore it requires more processing power and memory resources.
Additionally, the SRP requires more overhead since it uses selective acknowledgments (SACKs) to notify the sender about lost or out-of-order packets. As a result, it can increase network traffic.
Furthermore, it requires more buffering on both the sender and receiver sides to store the packets that are not yet acknowledged. This can be a problem if the network has limited buffering capacity.
Finally, the SRP can increase delay since the sender needs to wait for an acknowledgment for each packet before transmitting the next one.
Let’s take a look at the summary:
Advantages
Disadvantages
Efficient retransmission of lost packets
High complexity and difficult to implement
Sends SACKs for packets received out of order or lost
Requires more overhead due to the usage of SACKs
Helps in reducing network delay
Requires more buffering on both the sender and receiver sides
Provides high throughput
May increase packet waiting time
6. Conclusion
In this tutorial, we discussed a protocol used for the reliable delivery of data packets in networks: Selective Repeat Protocol (SRP). Furthermore, we presented an example of packet transmission using SRP.
Finally, we highlighted some crucial advantages and disadvantages of this protocol.