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

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


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)}]),

David N. Welton



More information about the erlang-questions mailing list