[erlang-questions] clarify: SO_REUSEADDR under darwin?

Serge Aleynikov saleyn@REDACTED
Fri Nov 9 14:00:24 CET 2007

Per Hedeland wrote:
> Actually no, it says that for multicast *addresses*, it is (there's no
> such thing as a multicast port:-). And this seems to be true on all of
> Linux, Darwin, and FreeBSD. I.e. you need to pass in an actual multicast
> address to bind to, instead of letting it default to the wildcard
> address - then reuseaddr is enough:
> mars 9> uname -sr
> FreeBSD 6.2-STABLE-200709
> mars 10> erl
> Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe]
> Eshell V5.5.5  (abort with ^G)
> 1> Port=4545.
> 4545
> 2> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]).
> {ok,#Port<0.96>}
> 3> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]).
> {ok,#Port<0.97>}
> 4> gen_udp:open(Port, [{reuseaddr, true}, {ip, {224,0,1,1}}]).
> {ok,#Port<0.98>}

Is this the "right" way of joining a multicast group though?  I've been 
using the "undocumented" add_membership inet option to accomplish that 
(though haven't tried it on anything other than Win, Linux, Solaris):

gen_udp:open(Port, [{reuseaddr, true}, {add_membership, {Addr, 

I haven't checked the inet_drv, but does it actually check if in the 
{ip, Addr} option Addr refers to a multicast range and sets the 


More information about the erlang-questions mailing list