What is TCP Keep Alive?

This page answers questions like these:

What Is TCP KeepAlive?

KeepAlive is a built-in function of TCP which, if enabled for a socket, will:
  1. Send “empty” packets across the connection whenever no data has been sent or received for a specified period of time.
  2. Declare that a socket connection is dead (and thus disconnect the socket) if the other side does not respond to the “empty” packets within a specified period of time.
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 Keep Alive?
Ephemeral Ports

Home  >  C++ / C  >  What is TCP Keep Alive?


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

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