A method of implementing reliable data transfer in Transport Layer Protocols. It works by letting a sender transmit less than packets without waiting for an Acknowledgement but have no more than unacknowledged packets.

When an acknowledgement is received for the earliest unacknowledged packet (base of the window), then a new packet can be sent and the window of unacknowledged packets move. Therefore is also called Window Size and GBN is referred to as a sliding-window protocol.

The receiver also maintains a window which represents the range of sequence numbers it can accept. If a packet is received in order it is immediately sent to the Socket. If a packet arrives out of order, the receiver stores it in a buffer and sends an acknowledgement which indicates the highest in-order sequence number it has received.

If an acknowledgement is not received within a certain time frame, there is a timeout and the sender resends only the packets for which it did not receive an acknowledgement. This approach reduces unnecessary re-transmissions and can improve network efficiency compared to Go-Back-N, but it comes at the cost of keeping track of individual packets.

Window Size

The window puts a constraint on the number of unacknowledged packets to control congestion.

The window size is however not easy to determine, larger windows allow more packet transmission to be pipelined but for too large windows Selective Repeat has a problem for the receiver to determine whether it gets a new packet or retransmission as shown by the scenarios below:

Examples

pkt2 is lost and only pkt2 is resend after a timeout.