[erlang-questions] Socket keepalive option

Per Hedeland <>
Tue Jun 17 01:19:30 CEST 2008

"Greg Burri" <> wrote:
>Thanks for your reply and explanation.
>I have theses values for a Debian distribution (Linux 2.6.25-2-amd64) :
>#> sysctl -a | grep keepalive
>net.ipv4.tcp_keepalive_time = 7200
>net.ipv4.tcp_keepalive_probes = 9
>net.ipv4.tcp_keepalive_intvl = 75
>Theses values are in second, so the tcp_keepalive_timetime is 2 hours.
>Is it possible to set this value directly from erlang code without
>changing the global system value ?

On Linux (only, as far as I know), you can set those parameters per
socket with setsockopt() calls, see tcp(7). Of course there is no direct
support for those in Erlang, but you should be able to do them with the
"raw" form of Option for inet:setopts/2.


More information about the erlang-questions mailing list