Search code examples
tcp

What ACK number does the receiver send after a fast retransmit in TCP?


I've learned that after three duplicate ACKs (so a total of 4 ACKs with the same value), the sender assumes that a packet was lost and sends the packet with that value again.

Here's a graph from the book I'm reading:

enter image description here

In this case, what does the receiver respond? ACK 120, or ACK 157?


Solution

  • This really depends whether or not SACK (Selective ACK) has been negotiated. If it has:

    • Each retransmission of ACK 100 will include a TCP SACK option indicating the aggregate of bytes that have been received after the missing segment that are pending if the gap is filled
    • Given what you show you should see SACK indicating that offsets 120-135, then 120-141, then 120-157.
    • When the missing 20 bytes are transmitted, you will see ACK 157

    If SACK has not been negotiated:

    • You will see ACK 100 indicating the missing segment for every segment after that
    • When the missing segment is sent, if it contains only the original 20 bytes, the ACK will be for 120 and all subsequent segments must be retransmitted as well.