[erlang-questions] inet buffer size, sndbuf and rcvbuf

David Welton davidnwelton@REDACTED
Fri Apr 18 17:24:20 CEST 2014


Hi,

In the inet man page ( http://www.erlang.org/doc/man/inet.html ) it states:

> {buffer, Size}

> Determines the size of the user-level software buffer used by the driver. Not to be confused with sndbuf and recbuf options which correspond to the kernel socket buffers. It is recommended to have val(buffer) >= max(val(sndbuf),val(recbuf)). In fact, the val(buffer) is automatically set to the above maximum when sndbuf or recbuf values are set.

So is there a good reason not to do this when it greatly speeds up
performance in some cases?

    {ok, [{recbuf, RecBufSize}, {sndbuf, SndBufSize}]} =
        inet:getopts(Sock, [recbuf, sndbuf]),
    inet:setopts(Sock, [{buffer, max(RecBufSize, SndBufSize)}]),

Thanks
-- 
David N. Welton

http://www.welton.it/davidw/

http://www.dedasys.com/



More information about the erlang-questions mailing list