Skip to main content

How does TCP detect segment loss?

TCP detects segment loss in two main ways:

  1. by a timeout,
  2. 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

  1. Segments are sent: 1, 2, 3, 4
  2. Segment 2 is lost
  3. The receiver gets 3 and 4, but is waiting for 2
  4. It sends ACK = 2 several times
  5. The sender sees 3 identical ACKs
  6. 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 ready
Premium

A concise answer to help you respond confidently on this topic during an interview.