<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div>thank you! it works</div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On Sunday, April 13, 2014 11:20 PM, Jacob <jacob01@gmx.net> wrote:<br> </font> </div>  <div class="y_msg_container">Hi<br clear="none"><div class="yqt8164806242" id="yqtfd25373"><br clear="none">On 13.04.2014 17:35, Dror Mein wrote:<br clear="none">> I had the same problem, but I thought using {keepalive,true} or<br clear="none">> {send_timeout,Time} would help. I see in wireshark that keep alive does<br
 clear="none">> not pass through but I still don't get an {error, closed}.<br clear="none">> Someone wrote that default timeout for keepalive is two hours. where can<br clear="none">> it be configured?</div><br clear="none"><br clear="none">TCP keepalive configuration is OS dependant. What OS are you using?<br clear="none"><br clear="none">NOTE: The following applies to _Linux_ :<br clear="none"><br clear="none">With Linux you can either set it<br clear="none">  a) globally via sysctl net.ipv4.tcp_keepalive_*<br clear="none">  b) globally per /proc/sys/net/ipv4/tcp_keepalive_*<br clear="none">  c) per socket with setsockopt() and TCP_KEEPCNT, TCP_KEEPIDLE,<br clear="none">TCP_KEEPINTVL<br clear="none">  d) per started (ELF) executable with the libkeepalive wrapper (see below).<br clear="none"><br clear="none">see tcp(7) for details.<br clear="none"><br clear="none">A helpful HOWTO can be found here:<br clear="none"><a
 shape="rect" href="http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/" target="_blank">http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/</a><br clear="none"><br clear="none">ad d):<br clear="none">See the HOWTO above for details. I installed the libkeepalive0 package<br clear="none">(Ubuntu 13.10), tried it with Erlang (erts-6.0) and according to strace<br clear="none">it seems to work. I would avoid LD_PRELOAD hacks in production though.<br clear="none"><br clear="none">The command line was<br clear="none">  LD_PRELOAD=libkeepalive.so KEEPCNT=20 KEEPIDLE=180 KEEPINTVL=60 erl<br clear="none"><br clear="none">If you want to use strace to check what happens enter:<br clear="none">  LD_PRELOAD=libkeepalive.so KEEPCNT=20 KEEPIDLE=180 KEEPINTVL=60 strace<br clear="none">-f -o keep.str -e trace=setsockopt erl<br clear="none"><br clear="none">and look into keep.str after using gen_tcp:connect/3.<br clear="none"><br
 clear="none">HTH,<br clear="none"><br clear="none">Jacob<div class="yqt8164806242" id="yqtfd20526"><br clear="none"><br clear="none"></div><br><br></div>  </div> </div>  </div> </div></body></html>