How does TCP detect segment loss?
TCP detects segment loss in two main ways:
- by a timeout,
- by repeated acknowledgments (duplicate ACK).
More simply: if an acknowledgment does not arrive in time, or the receiver reports the same byte several times, TCP considers the segment lost.
Method 1. Timeout (Retransmission Timeout, RTO)
How it works
- TCP sends a segment and starts a timer
- if the ACK does not arrive within the expected time:
- the segment is considered lost
- TCP sends it again
Characteristics
- it always triggers, even if the network "stays silent"
- it is slower, because it has to wait for the timeout
- it is reliable, as a "last line of defense"
Method 2. Duplicate ACKs (Duplicate ACK → Fast Retransmit)
How it works
- TCP expects data in order
- if the receiver gets segments after a gap, it:
- acknowledges the same ACK number several times
- when the sender receives 3 identical ACKs in a row:
- it concludes that the segment between them is lost
- it immediately retransmits it (without waiting for the timeout)
Why this is fast
- there is no need to wait for the timer to expire
- the loss is detected from the receiver's behavior
- it significantly speeds up recovery of the transmission
A visual example
- Segments are sent:
1, 2, 3, 4 - Segment
2is lost - The receiver gets
3and4, but is waiting for2 - It sends ACK = 2 several times
- The sender sees 3 identical ACKs
- It performs a Fast Retransmit of segment
2
What is important to remember
- TCP never gets an explicit "packet lost" message
- it draws conclusions indirectly:
- from timing
- from repeated ACKs
- after a loss, TCP:
- reduces its transmission speed
- tries not to overload the network
In short, for the interview
TCP detects segment loss by a timeout on a missing acknowledgment and by repeated ACKs (the Fast Retransmit mechanism), which allows lost data to be retransmitted in time.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.