Whenever a sending host sends a segment to a receiving host, the receiving hosts sends an acknowledgement of the last segment which was correctly received in order. The sending host maintains information on the current state of the sending window (next segment to send and last segment which was correctly received) and slides the window according to the last segment which was correctly received.
Cumulative acknowledgement means that when out-of-order acknowledgements are received (i.e. when some ACK is lost during transmission from receiver), the sender is sure that the receiver received the sent segments in order till the ACK of the highest sequence number.
To make it clear, consider the following scenario:
- Sending host 'A' sends 5 segments to receiving host 'B'
- Window size is 5 for both A and B
- Sender side variables: next_sequence_number, send_base
Case 1: Segment dropped during transmission from A to B
Assume Segments 3 and 4 are lost.
Since 5 segments were sent, next_sequence_number = 6, send_base = 1 (didn't receive ACKs yet)
1. B was expecting segment 1. It arrives. B sends an ACK for segment 1 and slides its receiving window by 1.
A receives the ACK for segment 1, slides the sending window by 1 and increments the send_base.
send_base = 2
2. B was expecting segment 2. It arrives. B sends an ACK for segment 2 and slides its receiving window by 1.
A receives the ACK for segment 2, slides the sending window by 1 and increments the send_base.
send_base = 3
3. B was expecting segment 3 but segment 5 arrived instead (as segments 3 and 4 were lost). B sends an ACK for segment 2. (as it was the last segment which had arrived in correct order). B doesn't slide its receiving window.
A was expecting ACK for segment 3 but receives the ACK for segment 2. Hence it doesn't slide the sending window by 1 and doesn't increment the send_base.
send_base = 3
B discards all the out-of-order segments (as we're talking about Go-Back-N here)
As the timer expires, A retransmits all the segments starting from send_base to next_sequence_number - 1, i.e segments 3, 4 and 5.
Case 2: ACK dropped during transmission from B to A.
Assume B received all the segments in order and sent the respective ACKs.
Assume ACK of segments 3 and 4 are lost.
1. A expecting ACK for segment 1, receives it, increments send_base and slides the window by 1. send_base = 2
2. A expecting ACK for segment 2, receives it, increments send_base and slides the window by 1. send_base = 3
3. A expecting ACK for segment 3, receives ACK for segment 5 instead. A becomes sure that B received the segments 3 and 4 as B wouldn't have sent ACK for segment 5 if it didn't receive segment 3 or segment 4.
Hence, A increments send_base by 3 and slides the window by 3.