Sliding Window Protocol (Selective Repeat)

The sliding window protocol is a flow control protocol that allows both link nodes A and B to send and receive data and acknowledgments simultaneously.

  • Here, the sender can send multiple frames without having to wait for acknowledgments.
  • If no new data frames are ready for transmission in a specified time, a separate acknowledgment frame is generated to avoid time-out.
  • Each outbound frame contains a sequence number ranging from 0 to 2𝑛−1(𝑛 bit field). For stop-and-wait sliding window protocol, 𝑛 = 1.

Sender Window

Sender Window is a set of sequence numbers maintained by the sender corresponding to the frame sequence numbers of frames sent out but not yet acknowledged.

  • The sender can transmit a maximum number of frames before receiving any acknowledgment without blocking (Pipelining).
  • All the frames in a sending window can be lost or damaged and hence must be saved in memory or buffer till they are acknowledged.

Receiving Window

A Receiving Window is a set of sequence numbers that is maintained by the receiver. It allows receiving and acknowledging of multiple frames.

  • The size of the receiving window is fixed at a specified initial size.
  • Any frame received with a sequence number outside the receiving window is discarded.
  • The sending and receiving window may not have the same size or any upper or lower limits.

Selective Repeat Protocol

The selective repeat protocol is an implementation of the sliding window protocol. In the selective repeat protocol, both the sender and the receiver maintain a window of outstanding and acceptable sequence numbers.

  • In SRP, the sender's window size starts at 0 and it grows to some predefined maximum.
  • The receiver's window is always fixed in size and equal to the predetermined maximum.
  • The receiver has the buffer reserved for each sequence number within its fixed window.
  • The sender and the receiver maintain a buffer of their window size.
  • If there is an error, the receiver checks the lower edge to the last sequence number before the lost frame sequence number.
  • The receiver continues to receive and acknowledge incoming frames.
  • The sender maintains a timeout clock for the unacknowledged frame number and retransmits that frame after the timeout.
  • The acknowledgment will be piggybacked to the sender. But when there is no traffic in the reverse direction, piggyback is impossible, a special timer will time out for the ACK so that the ACK is sent back as an independent packet. If the receiver suspects that the transmission has an error, it immediately sends back a negative acknowledgment (NAK) to the sender.

Note − SRP works better when the link is very unreliable. Because in this case, retransmission tends to happen more frequently, selectively retransmitting frames is more efficient than retransmitting all of them. In selective repeat protocol, the size of the sender and receiver windows must be at most one-half of 2𝑛.

Updated on: 23-Nov-2021

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started