[Devel] tcp keepalive question

Juha Heinanen jh at tutpro.com
Mon Dec 18 17:09:00 CET 2006


Bogdan-Andrei Iancu writes:

 > but if  understand correctly, this is something different that TCP KEEP 
 > ALIVE - actually the phone is sending a data over the TCP connection.

yes, this is not native tcp session keepalive, but crlfcrlf send as data
over the tcp connection.  it would be interesting to see what would
happen with native tcp session keepalive.  would it work as well as
crlfcrlf method?

 > the Klaus's concern is that the keepalive mechanism is not 
 > available/accessible an all the OSs; but this be partially solved via 
 > defines.

yes, we could turn native tcp session keepalive on linux only and use
crlfcrlf on other platforms.  perhaps crlfcrlf could be generated same
way as udp keepalives by nathelper/mediaproxy modules, where as native
tcp keepalive would be handled automatically by the kernel.

 > and to answer to Klaus's question - I made some experiments with pinging 
 > from nathelper - it works but there are some heavy drawbacks because of 
 > TCP nature - for example, if the client  closes the TCP connection and 
 > you was to generate a new ping, we will have to open a new TCP 
 > connection (that is the default behaviour of tcp_send() function) , 
 > which is quite impossible and may lead in longs delays -> timer process 
 > will be affected.

if there is no way to detect that tcp session does not exist before
sending crlfcrlf to SIP UA, then this indeed may lead to problems.

 > also I agree with Juha - if it is a simple solution, I will prefer
 > that.

i'm ready to test native tcp keepalive solution if you have time to turn
it on.  i guess it means setting some socket options on the tcp
connection.

-- juha



More information about the Devel mailing list