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.