Skip to content

TCP: reliability

Retransmission, and the ladder

How long TCP waits before deciding a packet is gone, and what it does when it is wrong twice.

TCP starts a timer when it sends. If the acknowledgement does not arrive before the timer expires, it sends the segment again and doubles the timer. One second, two, four, eight — the ladder is exponential because the network has just told you it is not coping, and asking again immediately would be the wrong response.

The timeout is not a constant. It is an estimate — a smoothed round-trip time plus four times its variance, clamped to a floor — so a connection over a fast path gives up on a packet much sooner than one over a slow path, without anybody configuring anything.

Karn's rule is the subtle part: a segment that was retransmitted yields no round-trip sample, because the acknowledgement cannot be attributed to either transmission. Without it the estimator collapses exactly when the network is worst.

Predict

A connection's first three SYNs go unanswered. Roughly how long has the client been waiting when the fourth goes out?

the first two SYNs are dropped

Segment

Click a segment on the timeline to open it.

Run

events
88
elapsed
63.34 s
ended
quiescent

The gaps between the retries are the whole story. Measure them.