gen_tcp buffering
Sean Hinde
sean.hinde@REDACTED
Fri Jan 9 15:11:00 CET 2004
On 8 Jan 2004, at 20:42, Eric Newhuis wrote:
> Does gen_tcp do any "user level" buffering of packets/binaries? And
> if it does then is there any way to report the number/size buffered?
> For both send and receive?
>
>
There is a socket option called 'buffer' which allows you to control
the size of this for receiving data - the driver will accumulate this
much before passing it into erlang.
you should be able to get the value using inet:getopts(Sock, [buffer]).
I have played with this option and it does seem to behave like this.
Erlang also does buffering on the output side. I seem to recall from a
previous post that if the socket would block the driver buffers data up
to a certain amount, after which the sending erlang process blocks
until something gives!
The socket options high_watermark and low_watermark seem to be the
things that control this, though at this point we are running into my
ability to understand inet_drv.c rather than actual experimentation.
Hope this helps.
Sean
More information about the erlang-questions
mailing list