TCP Keep Alive probes  
Author Message
grant_holler





PostPosted: 2005-7-11 1:42:00 Top

java-programmer, TCP Keep Alive probes Hi All,

I have a java client app and want to send TCP Keep Alive probes to my
server every 10 minutes as opposed to the default 2 hours. I see a
setKeepAlive() call in the API, but that only turns on whether you want
to send Keep Alives or not. How do i specify the Keep Alive probe
interval?

Thanks,

Grant.

 
Thomas Weidenfeller





PostPosted: 2005-7-11 15:40:00 Top

java-programmer >> TCP Keep Alive probes email***@***.com wrote:
> Hi All,
>
> I have a java client app and want to send TCP Keep Alive probes to my
> server every 10 minutes as opposed to the default 2 hours. I see a
> setKeepAlive() call in the API, but that only turns on whether you want
> to send Keep Alives or not. How do i specify the Keep Alive probe
> interval?

(a) TCP keep-alive is not what you think it is. It is a mechanism to
keep the TCP connection below the application alive (prevent that
timeouts kill the idle connection). It is not a mechanism to verify the
application layer end-to-end. E.g. the TCP/IP stack below a
server-process that hangs still processes the superfluous segments and
ACKs them, thus keeping the TCP connection alive while the server in
fact no longer works. On the other hand, missing keep-alive ACKs can't
be interpreted as connection failure, since empty ACKs are not reliable.

(b) The standard requires a minimum(!) of 2 hours. Any implementation
supporting smaller intervals is broken.

(c) Consider implementing a heartbeat on the application layer if you
really need to reliably know that your server-application is alive .

(d) If you work with a heartbeat consider doing it separately from your
application connections and instead use some separate management
protocol.

(e) If you don't need to know that your server is alive all the time,
just don't care about a connection. If you need to connect to the server
and you still have an open connection use it. If not, don't make a big
fuss and just establish a new one. Keeping connections alive for no
apparent reason is just a waste of network resources. So only have
connections to the server if you need one.

/Thomas

--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/