You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于TCP重复ACK的定义、触发场景及重传机制的技术咨询

TCP Basics: Duplicate ACKs, Retransmission Triggers, and RTO Explained for Beginners

Hey there! As someone who’s struggled through TCP’s nitty-gritty early on, let’s break your questions down with simple, concrete examples to make everything stick.


1. What’s a Duplicate ACK, and When Does It Trigger?

First, let’s define it plainly: a duplicate ACK is when the receiver sends the same acknowledgment number multiple times in a row, instead of incrementing it as expected.

Trigger Scenario: Out-of-Order Packets

TCP relies on in-order delivery, so if the receiver gets a packet that’s not the one it was expecting next, it will keep acknowledging the last sequence number it successfully received (in order). Each time it gets another out-of-order packet, it sends that same ACK again.

Example:

Suppose a client sends 3 packets to a server:

  • Packet 1: seq=1, data length 50 bytes (server expects next seq = 51)
  • Packet 2: seq=51, data length 50 bytes (server expects next seq = 101)
  • Packet 3: seq=101, data length 50 bytes (server expects next seq = 151)

If Packet 2 gets lost mid-transit:

  1. Server receives Packet 1 → sends ACK=51 (meaning "I’ve got all data up to seq=50; send me seq=51 next")
  2. Server receives Packet 3 (out of order—expected seq=51, got 101) → sends duplicate ACK=51 (1st duplicate)
  3. If the client sends Packet 4 (seq=151), server still expects seq=51 → sends another ACK=51 (2nd duplicate)
  4. Client sends Packet 5, server sends 3rd duplicate ACK=51

At this point (3 duplicate ACKs), the sender knows Packet 2 is almost certainly lost—so it triggers a fast retransmit (no waiting for a timeout!)


2. Is Retransmission Only Triggered When No ACK Is Received?

Nope! TCP has two main retransmission mechanisms:

  • Timeout Retransmission: The classic "wait and see" approach. If the sender doesn’t get any ACK for a packet after a set time (more on this time below), it assumes the packet is lost and retransmits it.
  • Fast Retransmission: As we saw above, if the sender gets 3 duplicate ACKs for the same sequence number, it skips the timeout and retransmits the missing packet immediately. This is way faster than waiting for a timeout, which is crucial for reducing latency.

Example:

Using the same scenario as before:

  • Timeout retransmit: If Packet 2 was lost and the server never sent any ACKs (unlikely, but possible if all ACKs were lost), the client would wait until its retransmission timer expires, then retransmit Packet 2.
  • Fast retransmit: As soon as the client gets 3 duplicate ACK=51 messages, it retransmits Packet 2 right away, cutting down on wait time.

3. Is Retransmission Time Equal to RTT + Safety Margin?

Not exactly—think of it as a dynamic, updated value based on network conditions, not a fixed "three-way handshake RTT + margin". Here’s the breakdown:

TCP tracks two key values to calculate the Retransmission Timeout (RTO):

  1. Smoothed RTT (SRTT): A weighted average of recent RTT measurements (not just the initial 3-way handshake RTT). This adapts to changing network speeds.
  2. RTT Variance (RTTVAR): A measure of how much RTT fluctuates—this is the "safety margin" part, to account for network jitter.

The standard formula (simplified) is:

SRTT = (1 - α) * SRTT + α * NewRTT  (α = 0.125 by default)
RTTVAR = (1 - β) * RTTVAR + β * |NewRTT - SRTT|  (β = 0.25 by default)
RTO = SRTT + 4 * RTTVAR

Example:

  • Initial state: After 3-way handshake, SRTT is measured as 100ms, RTTVAR is 20ms → RTO = 100 + (4*20) = 180ms
  • Later, a new RTT measurement is 120ms:
    • SRTT updates to (0.875100) + (0.125120) = 102.5ms
    • RTTVAR updates to (0.7520) + (0.25|120-102.5|) = 15 + 4.375 = 19.375ms
    • New RTO = 102.5 + (4*19.375) = 102.5 + 77.5 = 180ms (stays same here, but would adjust if RTT fluctuates more)

The initial 3-way handshake RTT just gives TCP a starting point—after that, it keeps updating SRTT and RTTVAR with every successful packet/ACK pair, so RTO is always tuned to current network conditions.


内容的提问来源于stack exchange,提问作者karthi97

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:45:52