TCP Timer Management
TCP uses several timers to ensure reliable, efficient, and orderly data transmission. These timers
help manage retransmissions, maintain connection health, and ensure proper closure of
connections. Understanding these timers is crucial for grasping how TCP achieves reliability in
data transfer.
Main Types of TCP Timers
Timer Name Purpose
Retransmission Retransmits lost segments if no acknowledgment (ACK) is received within the timeout
Timer period.
Prevents deadlock when the receiver’s window size is zero by periodically probing the
Persistence Timer
receiver.
Detects inactive connections by sending periodic probes; closes connection if no
Keepalive Timer
response.
Time-Wait Timer Ensures all packets from a closed connection are cleared before the port is reused.
Retransmission Timer
Purpose: Ensures reliable delivery by retransmitting segments that are not acknowledged in
time.
How it works: When TCP sends a segment, it starts the retransmission timer. If an ACK is
not received before the timer expires, TCP retransmits the segment.
Adaptive Timeout: The retransmission timeout (RTO) is not fixed. It is calculated based on
the measured round-trip time (RTT) and its variation, making it adaptive to network
conditions [1] [2] .
Calculation: TCP uses a smoothed RTT (SRTT) and deviation (RTTVAR) to set the RTO,
often following algorithms such as those described in RFC 6298.
Persistence Timer
Purpose: Prevents deadlock when the receiver advertises a zero window (i.e., cannot
receive more data).
How it works: If the receiver’s window size is zero, the sender starts the persistence timer.
When it expires, the sender sends a probe to check if the window has opened. If still zero,
the timer is restarted and the process repeats [3] [4] .
Benefit: Ensures that communication can resume as soon as the receiver is ready, even if
window update packets were lost.
Keepalive Timer
Purpose: Detects dead or inactive connections.
How it works: If a connection is idle for a long period, the keepalive timer sends a probe to
the other side. If no response is received after several probes, the connection is considered
dead and is closed [3] [4] .
Use case: Helps free up resources tied to abandoned connections.
Time-Wait Timer
Purpose: Ensures all packets from a closed connection are discarded before the port is
reused.
How it works: After a connection is closed, TCP waits for a period (usually twice the
maximum segment lifetime) before freeing the connection resources. This prevents delayed
segments from previous connections from being misinterpreted by new connections using
the same port [4] .
Benefit: Provides safety against packet confusion and ensures clean connection closure.
Additional Timers
Some implementations may also use:
SYN-Wait Timer: Limits how long TCP waits for a connection to be established.
FIN-Wait Timer: Limits how long TCP waits for the connection termination process to
complete [5] .
Summary Table
Timer Trigger Event Action on Expiry
Segment sent, no ACK Retransmit segment, double timeout (exponential
Retransmission
received backoff)
Persistence Zero window advertised Send probe to receiver
Keepalive Connection idle Send probe; close connection if no response
Time-Wait Connection closed Wait before releasing resources/port
SYN-Wait/FIN- Abort connection if handshake/closure not completed
Connection setup/teardown
Wait in time
In summary:
TCP timers are essential for managing retransmissions, avoiding deadlocks, detecting inactive
connections, and ensuring clean connection closure. Their adaptive and robust designs allow
TCP to provide reliable data transfer even over unpredictable networks [3] [1] [2] [4] .
⁂
1. https://www.geeksforgeeks.org/computer-networks/tcp-timers/
2. https://www.scaler.in/tcp-timers/
3. https://www.tutorialspoint.com/tcp-timers
4. https://www.studocu.com/in/messages/question/4813317/write-short-notes-on-i-tcp-timers-ii-http
5. https://info.support.huawei.com/hedex/api/pages/EDOC1100363264/AEN0403J/05/resources/vrp/dc_vr
p_ipv4_cfg_0031.html