The receiver has one state variable:

The receiver has one state variable:

Save it and send an acknowledgment for the packet.

Forward acknowledged packets at the beginning of the window to the application layer and advance windowStart past these packets.

Send an acknowledgment for the packet and toggle expected.

Forward the packet to the application layer.

Just send an acknowledgment for the packet. The sender must not have received the previous acknowledgment.

The same as the sequence number of the received packet.

The lowest sequence number that has not yet been received.

Reliable Data Transfer Receiver

Alternating Bit Go Back n Selective Repeat Cumulative Acknowledgment
Receiver initialization
Response to an incoming packet with the expected sequence number
Response to an incoming packet with an unexpected sequence number
Receiver acknowledgment sequence number