We have learned how TCP works. It involves a handshake and acknowledgment from the receiver for each packet or the frame received. This procedure looks fine when the transmission is for smaller data. What if there are millions or billions of data packets or frames? In the present Internet transaction era, it is quite possible. So, how are the packets transmitted in this scenario? Yes. The acknowledgment should be given after the successful receiving of some set of frames rather than at every frame. Let’s take it slowly how this is gonna work!
Sliding window protocol:
It is a flow control protocol. What is flow control? From the name, it is observed that it is used to control the flow. What is the flow here? The transfer of data from one end to the other. Why it should be controlled? Let’s say, there is a cup of capacity 100 ml. What if you fill quantity more than 100 ml? It will overflow and the substance gets wasted. It is the same in our context. If the sender is transmitting the data that overwhelms the capacity of the receiver, then the data gets lost. So, to prevent this data loss, the flow control protocol is used. This is the story behind the single sentence “It is a flow control protocol”.
This protocol allows the sender to send multiple frames to the receiver without acknowledgments. It works with the help of a window that slides in sync with the acknowledgments received from the receiver. The maximum number of frames that can be sent from the sender depends on the size of the window of the sender. Each frame has a sequence number that is used to uniquely identify the frame and prevent data loss.
Types of Acknowledgement:
Cumulative Acknowledgment: The acknowledgment is sent after the transmission of certain frames instead of acknowledging frames individually. It offers less traffic but unreliable. The incoming packets do not have to wait for acknowledgment, hence less traffic. But if there is a loss in the acknowledgment, it means that the entire set of frames transmitted are lost, thus unreliable.
Independent Acknowledgment: It is the traditional way of transmission. The acknowledgment is received after each frame. This is reliable as the loss in acknowledgment means that there is a loss in the single frame transmitted. But this increases the traffic since the frames should wait for the acknowledgment of the earlier frames.
Each type has its own pros (advantages) and cons (disadvantages).
Optimal window size:
What is the optimal size of the window that is used in the sliding window protocol? Here is the deduction.
From our earlier discussions in Network Performance, we are aware of kinds of delays and their formulae. Once again, we shall go on a trip to them.
Efficiency: It is the ratio of the useful time to the total cycle time of a packet.

Sequence Numbers:
For every frame that is transmitted, there exists an unique number to identify the frame, if it is lost. This number is called as a sequence number.
From the Figure 1, it is evident that the number of frames that can be sent from a sender are 1+2a.
Now to represent these frames, the minimum requirement of sequence numbers is also 1+2a——— Eq 1.
If n is the size of sequence number field in the header, then the total sequence numbers will be 2n ;n>0 ———–Eq 2.
Suppose there is a 2-bit field. Then the possibilities are 00, 01, 10, and 11 which sums up to 4.
From Eq 1 and Eq 2; 2n = 1+2a
Applying log on both sides,
n= log2(1+2a). So to get 1+2a sequence numbers, the size of the field or the field should be log2 (1+2a) bits.
3 thoughts on “Sliding Window Protocol”