[erlang-questions] Socket keepalive option

Edwin Fine <>
Tue Jun 17 16:22:40 CEST 2008


You don't have telepathic abilities? Sorry to hear that :)
I don't either, so I misunderstood your original answer. Thanks for
clarifying it.

On Tue, Jun 17, 2008 at 9:26 AM, Per Hedeland <> wrote:

> "Edwin Fine" <> wrote:
> >
> >Isn't he asking if there is any way to do this on a per-process basis,
> >rather than for every process in the system?
>
> There's no mention of "per-process" in the question, so lacking
> telepathic capabilities I have to assume that he isn't - what he *is*
> asking is "from erlang code without changing the global system value"
> (where "the global system value" is obviously the same as "for every
> process in the system"), and that's what my answer covered. Either way,
> "per-socket using setsockopt(), and only on Linux" is the only answer I
> know of that doesn't involve changing the global system value.
>
> --Per
>
> >On Mon, Jun 16, 2008 at 7:19 PM, Per Hedeland <> wrote:
> >
> >> "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.
> >>
> >> --Per
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080617/b28ebd84/attachment.html>


More information about the erlang-questions mailing list