Skip to content
uencoder

TCP Keep-Alive

TCP keep-alive sends probe packets periodically while a connection is idle, detecting whether the peer is alive so half-open connections can be reclaimed promptly.

Purpose

It detects peer crashes or network failures on long-lived connections, preventing connection leaks and useless waiting.

Mechanism

After the idle timeout, a data-less ACK probe is sent; an ACK back means alive, an RST closes the connection, and silence triggers retries until the probe count runs out, at which point the connection is declared dead. Parameters: interval, probe count, timeout.

Use cases

  • Liveness checks on long-lived connections
  • Connection pool maintenance
  • NAT keep-alive

Related tools

References