The TCP Keepalive Timer

If you’re new to the world of TCP/IP, you may be quite confused to hear that no data at all flows across an idle TCP connection.  Just to clarify, if no process on either side of the connection is sending data then nothing at all will be exchanged by the 2 TCP modules.  Many networking protocols poll each other to see if they’re still around but this doesn’t happen with TCP/IP.  This is of course important for all sorts of reasons from any client server application, from your email to watching your BBC iPlayer application from there web servers – more information on that topic here –

Available on Youtube from this site – www.dnsproxy.co.uk

In practice this actually means that you can start a client process on your PC that establishes a server connection via TCP without fear of overhead.  You can literally walk away for an hour, day or weeks and the connection will stay in place. The only thing that will break that connection is that of either of the hosts switching off.

However there are certain times when a server needs to know if the client is still there.  For TCP this facility is provided by the Keepalive timer.  Now for the purists many people feel that this timer is not necessary – suggesting that the feature should be completed at the application layer if it’s really needed.

One of the reasons it is not liked is because it can bring down a good connection.  FOr example is the keepalive probes are sent when perhaps a router in between the client and host is being rebooted then the connection would fail.   TCP would in this instance believe that the client’s host may have crashed and then reset the connection.

Of course the main reason it’s used is for server applications.  If a server is keeping up hundreds of connections for clients which have disappeared then resouces are being wasted.  It can happen in all sorts of circumstances for example if you just power off a client in the middle of a telnet session without logging off – a connection is still left open.

Additional Information – http://iplayerusa.org/index.php/proxy-to-access-bbc-iplayer-abroad/