[erlang-questions] Multicast UDP sending question

Tony Rogvall tony@REDACTED
Tue Nov 17 19:09:59 CET 2009


Try the reuse port option? pass it to inet:setopts or gen_udp:open.

You have to craft it a bit your self.

reuse_port() ->
    [{raw,?SOL_SOCKET,?SO_REUSEPORT,<<1:32/native>>}].


where 

-define(SOL_SOCKET,   16#ffff).

and

%% enables duplicate address and port bindings
-define(SO_REUSEPORT, 16#0200). 

This is tested on mac os x 10.4/10.5/10.6

Maybe it's the same in linux?

/Tony





On 17 nov 2009, at 15.45, Jarrod Roberson wrote:

> On Tue, Nov 17, 2009 at 9:15 AM, Valentin Micic <v@REDACTED>wrote:
> 
>> 
>> You cannot open the same UDP port twice (or, shall I say -- bound the same
>> UDP port to two different sockets). The story about N, N+1 port as well as
>> explanation indicated that this is an Erlang restriction due to the socket
>> library used is - well... pure fiction.
>> 
> 
> thanks for the clarification. I am not sure how the Erlang internals work.
> Can you explain what {reuseaddr,true} does then, if not bind the same UDP
> port to multiple sockets.
> There are LOTS of applications on a OSX that all bind to 224.0.0.251:5353,
> is there a semantic different I am missing.
> Thanks for taking the time to explain this.



More information about the erlang-questions mailing list