Key Takeaways
- Plain TCP acknowledgements are cumulative: they only say 'everything up to here arrived'.
- SACK adds the ranges received after a gap, so the sender knows exactly what is missing.
- Only lost segments are resent, which helps on lossy or long-distance links.
- Defined in RFC 2018 and enabled by default in modern operating systems.
What Is Selective Acknowledgment?
Selective acknowledgment (SACK) is an option in TCP, the protocol underneath the web, APIs and WebSockets. Normally a TCP receiver sends a cumulative acknowledgement - "I have everything up to byte X". If one segment is lost, everything after it looks unacknowledged too. SACK lets the receiver add "and I also have these later blocks", so the sender knows exactly which piece went missing.
An Example
The sender transmits segments 1 to 5 and segment 3 is lost.
- Without SACK: the receiver can only acknowledge up to segment 2. The sender may resend 3, 4 and 5, wasting bandwidth, or wait for timeouts.
- With SACK: the receiver acknowledges up to 2 and reports blocks 4-5 received. The sender resends only segment 3.
How It Is Negotiated
Both ends announce SACK-permitted in the TCP handshake (SYN). Afterwards, acknowledgements can carry up to a few SACK blocks, each a start and end of received data. It is specified in RFC 2018, with D-SACK (RFC 2883) reporting duplicate segments. Real-time media over UDP uses different feedback, such as TWCC.
Frequently Asked Questions
What is SACK in networking?
What is the difference between SACK and a cumulative ACK?
Is TCP SACK enabled by default?
Does SACK matter for chat apps?
Free plan, no credit card required.