# Daily Learning: Computer Networks – Sliding Window Protocol

## Go Back N

If there is a packet lost in the receiver side then it is going to discard the subsequent packets and re transmit the the entire window means it is going back N values and re transmit the the packets

• Sender window size is go back N is N
• Receiver Window size is always 1.
• Acknowledgement –
• Cumulative – One acknowledgement is used for many packets.
• Adv – Traffic is low
• Dis Adv – Reliability low
• Independent – One acknowledgement is used for one packet.
• Adv – Reliability is high
• Dis Adv – Traffic is high

Relationship Between Window Sizes and Sequence Numbers

Minimum sequence numbers required in GBN = N + 1

Bits Required in GBN = log2 (N + 1)

If the sequence number is N then Sender window size is N – 1. Receiver window size is 1.

If the bit is K then sequence number 2^k, Sender Window size is 2^k – 1. Receiver window size is 1.

### Formula

• Maximum window size = 1 + 2 * a [a=Tp/Tt]
• Minimum sequence numbers required = 1 + 2 * a
• Number of Bits in Sequence Number Field = log2(1+2a)

## Selective Repeat

### Selective Repeat

This protocol(SRP) is mostly identical to GBN protocol, except that buffers are used and the receiver, and the sender, each maintains a window of size. Here we only re transmit the lost packet not the entire window again.

• Sender window size is greater than 1 (Ws > 1)
• Receiver window size = sender window size (Wr == Ws)
• Acknowledgements are independent. If bits in the packets are corrupted then SR will send a negative acknowledgement.

Note – If N is the size of sequence number field in the header in bits, then we can have 2N sequence numbers.

Window Size = min(1+2*a, 2^N)