Fundamentals 12 min read

Mastering TCP Retransmission: Timeout, Fast Retransmit, SACK, and Congestion Control

This article explains TCP's retransmission mechanisms—including timeout retransmission, fast retransmit, SACK and D‑SACK—along with sliding window operation, window sizing, and congestion control algorithms such as slow start, congestion avoidance, and fast recovery, providing a comprehensive network fundamentals guide.

Open Source Linux
Open Source Linux
Open Source Linux
Mastering TCP Retransmission: Timeout, Fast Retransmit, SACK, and Congestion Control

Retransmission Mechanism

Retransmission mechanisms address packet loss in complex networks. Common methods include timeout retransmission, fast retransmit, SACK, and D‑SACK.

Timeout Retransmission

When sending data, a timer is set; if an ACK is not received before the timer expires, the packet is resent. TCP triggers timeout retransmission when either the data packet or its ACK is lost. The retransmission timeout (RTO) should be slightly larger than the round‑trip time (RTT).

If a packet times out repeatedly, TCP doubles the timeout interval each time, reducing the sending rate in poor network conditions.

Fast Retransmit

Fast retransmit is data‑driven rather than time‑driven. When the sender receives three duplicate ACKs, it assumes a packet loss and retransmits the missing segment without waiting for the timer.

SACK Method

Selective Acknowledgment (SACK) adds an option to the TCP header that allows the receiver to inform the sender which blocks of data have been received, enabling the sender to retransmit only the missing segments.

Duplicate SACK (D‑SACK)

D‑SACK uses SACK to indicate which data has been received multiple times, helping the sender differentiate between duplicate packets and genuine loss.

Sliding Window

The sliding window provides a buffer in the operating system to improve communication efficiency. The sender must retain sent data in the buffer until an ACK is received. TCP uses the sliding window for flow control, ensuring the receiver can process incoming data.

Window Size

The TCP header contains a 16‑bit window field that indicates the receiver's available buffer size. The sender adjusts its sending rate based on this advertised window, which is roughly equal to the receiver's advertised window.

Receive Window

The receiver advertises its window size (RWND) to the sender, allowing the sender to avoid overwhelming the receiver.

Send Window

The sender's window (SWND) is limited by the minimum of the congestion window (cwnd) and the receiver's advertised window (rwnd).

Congestion Control

Congestion control complements flow control by reacting to network congestion, which can cause packet loss. TCP employs four algorithms: slow start, congestion avoidance, congestion occurrence, and fast recovery.

Slow Start

After a connection is established, TCP slowly increases the number of packets sent. Each received ACK increments the congestion window (cwnd) by one. When cwnd reaches the slow‑start threshold (ssthresh), TCP switches to congestion avoidance.

Congestion Avoidance

During congestion avoidance, cwnd grows linearly (by 1/cwnd for each ACK) rather than exponentially, reducing the risk of congestion.

Congestion Occurrence

TCP assumes packet loss signals network congestion. When loss is detected via timeout or fast retransmit, TCP reduces cwnd and adjusts ssthresh.

Fast Recovery

After three duplicate ACKs trigger fast retransmit, TCP enters fast recovery: cwnd is set to ssthresh + 3, the lost packet is retransmitted, and cwnd grows by one for each additional duplicate ACK until a new ACK arrives, after which cwnd is set to ssthresh and normal congestion avoidance resumes.

Why Three Duplicate ACKs?

Two duplicate ACKs often result from packet reordering, while three duplicate ACKs reliably indicate a loss; using three balances detection speed and false positives.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

TCPSliding Windowcongestion controlnetwork fundamentalsretransmissionSACK
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.