What Is TCP KeepAlive?

This page answers questions like these:

Related Links:
How To Use TCP KeepAlive?
What Are The Default TCP KeepAlive Parameters?
TCP KeepAlive Parameter Ranges
How Do I Check That TCP KeepAlive Is Working?
Ephemeral Ports



What is TCP KeepAlive?

KeepAlive is a built-in function of TCP which, if enabled for one end of a socket, will:
  1. Send “empty” packets from the KeepAlive-enabled socket end to the other socket end whenever no data has been sent for a specified period of time.
  2. Declare that a socket connection is dead (and thus disconnect the socket) if the other end of the socket does not respond to the “empty” packets within a specified period of time.
KeepAlive Technical Details:


What Problems Can TCP KeepAlive Solve?

Enabling KeepAlive on a socket can help you to do either of these two very different things:
  1. Keep an idle socket connection alive.
  2. Detect whether the computer at the other end of a socket is alive.
Examples of these are, respectively:
  1. Stop a router from dropping the socket connection because the router thinks the connection has been idle for too long.
  2. Detect whether the machine on the other end of a socket is still alive even though it hasn’t sent you any data for a long period of time.




Related Links:
How To Use TCP KeepAlive?
What Are The Default TCP KeepAlive Parameters?
TCP KeepAlive Parameter Ranges
How Do I Check That TCP KeepAlive Is Working?
Ephemeral Ports

Home  >  C++ / C  >  What Is TCP KeepAlive?


Tags: KeepAlive, keep alive, tcpip keepalive, keep an idle socket connection alive, keep an idle socket alive, detect whether the computer at the other end of a socket is alive, detect whether a socket is alive, keep a socket connection alive, socket, TCP, Transmission Control Protocol, C++, C

Src: tcp-keepalive-what.txt
Dst: C++-C/what-is-tcp-keepalive.htm
Ads: 3