<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div><a href="https://github.com/schlagert/bootstrap" target="_blank">https://github.com/schlagert/bootstrap</a> works for me and looks well-founded, in particular it avoids SO_REUSEADDR

<div> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Dienstag, 13. Mai 2014 um 09:08 Uhr<br/>
<b>Von:</b> "Tobias Schlager" <Tobias.Schlager@lindenbaum.eu><br/>
<b>An:</b> Erlang <erlang-questions@erlang.org><br/>
<b>Betreff:</b> Re: [erlang-questions] windows multicast</div>

<div name="quoted-content">If you're looking for a UDP-based tool to discover and connect nodes (multicast/broadcast) you might find this one useful<br/>
<br/>
<a href="https://github.com/schlagert/bootstrap" target="_blank">https://github.com/schlagert/bootstrap</a><br/>
<br/>
It is able to handle multiple nodes per host.<br/>
<br/>
Regards<br/>
Tobias<br/>
<br/>
________________________________________<br/>
Von: "Jörg Maushake" [joerg.maushake@gmx.de]<br/>
Gesendet: Montag, 12. Mai 2014 21:54<br/>
An: Tobias Schlager<br/>
Cc: Erlang<br/>
Betreff: Aw: Re: [erlang-questions] windows multicast<br/>
<br/>
Ok, important to know this, good advice, so the solution needs to deal with those variants<br/>
<br/>
<br/>
> Gesendet: Montag, 12. Mai 2014 um 11:04 Uhr<br/>
> Von: "Tobias Schlager" <Tobias.Schlager@lindenbaum.eu><br/>
> An: Erlang <erlang-questions@erlang.org><br/>
> Betreff: Re: [erlang-questions] windows multicast<br/>
><br/>
> I would not consider this a problem of Erlang. AFAIK, the behaviour of 'SO_REUSEADDR' for UDP sockets is highly OS dependent.<br/>
><br/>
> If I remember correctly, on Linux, SO_REUSEADDR 'steals' the incoming traffic from the process that previously opened the port. Thus, the previous process will no longer get incoming packets on that port.<br/>
><br/>
> Regards<br/>
> Tobias<br/>
><br/>
> ________________________________________<br/>
> Von: erlang-questions-bounces@erlang.org [erlang-questions-bounces@erlang.org]" im Auftrag von ""Jörg Maushake" [joerg.maushake@gmx.de]<br/>
> Gesendet: Sonntag, 11. Mai 2014 22:27<br/>
> An: Sergej Jurecko<br/>
> Cc: Erlang<br/>
> Betreff: Re: [erlang-questions] windows multicast<br/>
><br/>
> yes with windows (in contrast to osx) multiple nodes calling gen_udp:open targeting one local interface<br/>
> of the machine dont work<br/>
> { reuseaddr, true } seems to be ignored.<br/>
><br/>
> Is is an erlang bug? The bug: gen_udp:open ignores { reuseaddr, true } under windows<br/>
><br/>
> Across two windows boxes one node on each works<br/>
> jm<br/>
><br/>
> > Gesendet: Sonntag, 11. Mai 2014 um 13:30 Uhr<br/>
> > Von: "Sergej Jurecko" <sergej.jurecko@gmail.com><br/>
> > An: "Jörg Maushake" <joerg.maushake@gmx.de><br/>
> > Cc: "Gokhan Boranalp" <kunthar@gmail.com>, Erlang <erlang-questions@erlang.org><br/>
> > Betreff: Re: [erlang-questions] windows multicast<br/>
> ><br/>
> > You probably can’t listen on the same port from two erlang instances.<br/>
> ><br/>
> > Sergej<br/>
> ><br/>
> > On 11 May 2014, at 13:25, Jörg Maushake <joerg.maushake@gmx.de> wrote:<br/>
> ><br/>
> > > Thank You for this detailled reply.<br/>
> > > Does your windows code work on two nodes started on one machine?<br/>
> > > On my machine im still getting eaddrinuse when trying to run the code in two nodes.<br/>
> > > I did the following, to verify the code used for windows:<br/>
> > ><br/>
> > > Mc = {230, 0, 0, 1},<br/>
> > > Src = {192,168,2,101},<br/>
> > > %% 1> inet:getiflist().<br/>
> > > %% {ok,["169.254.82.58","192.168.2.101","127.0.0.1"]}<br/>
> > > %% 2><br/>
> > > Opts = [ { active, true },<br/>
> > > { ip, Src },<br/>
> > > { multicast_loop, true },<br/>
> > > { reuseaddr, true },<br/>
> > > list<br/>
> > > ],<br/>
> > > { ok, RecvSocket } = gen_udp:open (Port, Opts),<br/>
> > > inet:setopts(RecvSocket, [{ add_membership, { Mc, Src }}]),<br/>
> > ><br/>
> > > And it works when starting a node. But when starting another node (on the same maching) im still getting<br/>
> > > Address in use:<br/>
> > ><br/>
> > > !! eaddrinuse<br/>
> > ><br/>
> > > im using R16B03-1<br/>
> > ><br/>
> > ><br/>
> > >> Gesendet: Sonntag, 11. Mai 2014 um 07:55 Uhr<br/>
> > >> Von: "Sergej Jurecko" <sergej.jurecko@gmail.com><br/>
> > >> An: "Jörg Maushake" <joerg.maushake@gmx.de><br/>
> > >> Cc: "Gokhan Boranalp" <kunthar@gmail.com>, Erlang <erlang-questions@erlang.org><br/>
> > >> Betreff: Re: [erlang-questions] windows multicast<br/>
> > >><br/>
> > >> Multicast in erlang is kind of weird.<br/>
> > >> I actually have slightly different code for different platforms. This is code from r14 days. I’m not sure if it works any differently now, but I did have issues finding the right combination of parameters to get it to work. Nothing worked universally across all platforms.<br/>
> > >><br/>
> > >> Mc = multicast address<br/>
> > >> Src = source ip of local interface<br/>
> > >><br/>
> > >> Windows:<br/>
> > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Src}, {multicast_ttl, 1}, {multicast_loop, false}, binary]),<br/>
> > >> inet:setopts(SockSrc, [{add_membership, {Mc, Src}}]);<br/>
> > >><br/>
> > >> linux,freebsd:<br/>
> > >><br/>
> > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, {0,0,0,0}}, {add_membership, {Mc, Src}},{active,true}, binary,{recbuf, 1024*1024}]);<br/>
> > >><br/>
> > >> osx:<br/>
> > >><br/>
> > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Mc}, {multicast_ttl, 1}, {multicast_loop, false},{recbuf, 1024*1024}, binary]),<br/>
> > >> inet:setopts(SockSrc, [{add_membership, {Mc, {0,0,0,0}}}])<br/>
> > >><br/>
> > >><br/>
> > >> Sergej<br/>
> > >><br/>
> > >> On 10 May 2014, at 21:37, Jörg Maushake <joerg.maushake@gmx.de> wrote:<br/>
> > >><br/>
> > >>> Restarting windows does not change anything.<br/>
> > >>> I deployed the code to macbook where it works.<br/>
> > >>> It seems to be a windows issue<br/>
> > >>> otp_release: R16B03-1<br/>
> > >>><br/>
> > >>> Gesendet: Samstag, 10. Mai 2014 um 17:18 Uhr<br/>
> > >>> Von: "Gokhan Boranalp" <kunthar@gmail.com><br/>
> > >>> An: "Jörg Maushake" <joerg.maushake@gmx.de><br/>
> > >>> Cc: Erlang <erlang-questions@erlang.org><br/>
> > >>> Betreff: Re: [erlang-questions] windows multicast<br/>
> > >>> Restart your computer.<br/>
> > >>><br/>
> > >>> On Sat, May 10, 2014 at 5:58 PM, "Jörg Maushake" <joerg.maushake@gmx.de> wrote:<br/>
> > >>>> Hi list,<br/>
> > >>>> I am using erlang on windows 7.<br/>
> > >>>><br/>
> > >>>> When i start a multicast (the code is from nodefinder) like so:<br/>
> > >>>> Opts = [ { active, true },<br/>
> > >>>> { ip, {230, 0, 0, 1} },<br/>
> > >>>> { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } },<br/>
> > >>>> { multicast_loop, true },<br/>
> > >>>> { reuseaddr, true },<br/>
> > >>>> list<br/>
> > >>>> ],<br/>
> > >>>> { ok, RecvSocket } = gen_udp:open (4321, Opts),<br/>
> > >>>><br/>
> > >>>> i get this {error,eaddrnotavail}<br/>
> > >>>><br/>
> > >>>> Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work!<br/>
> > >>>> But when i then start another node on the same machine the error i get is:<br/>
> > >>>> {error,eaddrinuse}<br/>
> > >>>><br/>
> > >>>> (The multicast group and port works with java )<br/>
> > >>>><br/>
> > >>>> Any suggestions ?<br/>
> > >>>><br/>
> > >>>> _______________________________________________<br/>
> > >>>> erlang-questions mailing list<br/>
> > >>>> erlang-questions@erlang.org<br/>
> > >>>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br/>
> > >>>><br/>
> > >>><br/>
> > >>><br/>
> > >>><br/>
> > >>> --<br/>
> > >>> BR,<br/>
> > >>> \|/ Kunthar<br/>
> > >>> _______________________________________________<br/>
> > >>> erlang-questions mailing list<br/>
> > >>> erlang-questions@erlang.org<br/>
> > >>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br/>
> > >><br/>
> > >><br/>
> ><br/>
> ><br/>
> _______________________________________________<br/>
> erlang-questions mailing list<br/>
> erlang-questions@erlang.org<br/>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br/>
> _______________________________________________<br/>
> erlang-questions mailing list<br/>
> erlang-questions@erlang.org<br/>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br/>
><br/>
_______________________________________________<br/>
erlang-questions mailing list<br/>
erlang-questions@erlang.org<br/>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a></div>
</div>
</div>
</div></div></body></html>