UDP over v6: payload truncated at 1024 bytes

Fredrik Thulin ft@REDACTED
Mon Apr 5 15:37:00 CEST 2004

On Monday 05 April 2004 15.26, Luke Gorrie wrote:
> Fredrik Thulin <ft@REDACTED> writes:
> > So it seems Erlang uses a 8k buffer for v4 and 1k buffer for v6. That
> > does not seem right. In fact, since the biggest UDP datagram size is 64k
> > I think the buffer ought to be 64k for both v4 and v6.
> That sounds like the most reasonable default to me too.

On second thought, 8k might not be such a bad default after all since (as a 
colleague of mine pointed out) you would otherwise use a megabyte of memory 
with just 16 threads waiting for data.

> You can set this in your code when you open the sockets. Just include
> this option in gen_udp:open -
>   {recbuf, 65535}
> The available options are in the 'erl -man inet' page, under
> setopts/2. gen_udp and gen_tcp accept these same options.

That worked like a charm, thanks!

Hopefully someone will increase the default v6 receive-buffer though... 1k is 
really too small.


More information about the erlang-questions mailing list