When a packet is lost in transit, the protocol must decide how to retransmit it. There are two main strategies:
Go-Back-N (GBN)
In Go-Back-N, the receiver only accepts packets in strict, sequential order. If packet 2 is lost, the receiver discards all subsequent packets (3, 4, 5), even if they arrive safely.
The sender's timeout is triggered for packet 2, and the sender must retransmit packet 2 and all following packets in the window (2, 3, 4, 5). This is simple to implement but wastes bandwidth on lossy networks.
Selective Repeat (SR)
In Selective Repeat, the receiver accepts out-of-order packets and buffers them. If packet 2 is lost but 3, 4, and 5 arrive, the receiver keeps them and sends ACKs for them.
The sender detects that only packet 2 is missing and retransmits *only* packet 2. Once packet 2 arrives, the receiver merges it with the buffered packets and delivers them in order to the application, minimizing retransmission traffic.