[erlang-questions] UDP questions

Joe Armstrong <>
Wed Jan 27 16:27:13 CET 2016


Hello,

I have a simple UDP client/server

The server is on a fixed port 4567 - I open it like this

    {ok, Socket} = gen_udp:open(4567, [binary]),

then wait for registrations
    receive
{udp, Socket, _Ip, _Port, <<"register">>) ->


Clients do this:

     {ok, Socket} = gen_udp:open(0, [binary]),
     gen_udp:send(Socket, "localhost", 44567, <<"register">>),
     ...

I'm testing on "localhost"

After registration the processes send binaries to each other

This works fine for small binaries but gen_udp:send fails  with
{error,emsgsize} for large binaries

So I have a few questions:

    1) Can I find out the max binary size that can be sent/received?
    2) Can I increase the max size?
    3) Is there a guaranteed minimum packet length that will not be fragemented?
    3) Can received packets be fragmented - TCP has a  {packet,N}
       option and some built-in defragmentation, what's the story for
       UDP?

I think I know the answers to these but I'm not really sure - could somebody
who really knows enlighten me?

Thanks

/Joe


More information about the erlang-questions mailing list