Operating System - Tru64 Unix
1754403 Members
3074 Online
108813 Solutions
New Discussion юеВ

Lost Connection Recognition

 
SOLVED
Go to solution
Tholen
New Member

Lost Connection Recognition

Our customer has a unreliable network, therefore our software has to rely an fast recognition, if tcp connections are lost. We found out that there are some parameters that can be configured using sysconfig:

tcp_keepalive_default=0
tcp_keepcnt=8
tcp_keepidle=14400
tcp_keepintvl=150

Question: Is there any reason why tcp_keepidle's default value is so high (14400 = 2 hours). Could we easily set this to 60 (which is 30 sec) or are there any risks breaking other software.

3 REPLIES 3
Ralf Puchner
Honored Contributor

Re: Lost Connection Recognition

These parameters will only be honored if the application is programmed for.

The default timeout value is 2 hours but can be minimized depending on the network.

It would be better to improve the network instead of changing kernel parameters
Help() { FirstReadManual(urgently); Go_to_it;; }
Tholen
New Member

Re: Lost Connection Recognition

> These parameters will only be honored if the application is programmed for.
As far as i understand the man pages the tcp_keepalive_default enables this feature for ALL sockets. It doesn't matter, whether application uses setsockopt() to enable keep alive or not. Or am i wrong?

>It would be better to improve the network instead of changing kernel >parameters.
Unfortunatly its our customers network and we have no influence on this, they even do not have DNS for the computers in their network :(
Ralf Puchner
Honored Contributor
Solution

Re: Lost Connection Recognition

The KEEPALIVE option causes the underlying TCP/IP implementation to regularly check the connection to make sure that the process on the other end of the socket is still there and responding. If it doesn't respond, the connection is broken and the client receives a SIGPIPE signal which causes it to exit.

But it is important, that the application can handle the signal and the case the socket will be closed.

The KEEPALIVE mechanism should prevent that sockets hang in TIME_WAIT state over a long time - nothing else!

If network quality is worse the keepalive (and normal) packets will be lost and socket will be closed to early....

So it is a bad idea to minimizes the intervalls in case of network problems!
Help() { FirstReadManual(urgently); Go_to_it;; }