[erlang-questions] windows multicast

"Jörg Maushake" joerg.maushake@REDACTED
Sun May 11 22:27:17 CEST 2014


yes with windows (in contrast to osx) multiple nodes calling gen_udp:open targeting one local interface 
 of the machine dont work 
  { reuseaddr, true } seems to be ignored.
 
 Is is an erlang bug? The bug: gen_udp:open ignores { reuseaddr, true } under windows
 
 Across two windows boxes one node on each works
 jm

> Gesendet: Sonntag, 11. Mai 2014 um 13:30 Uhr
> Von: "Sergej Jurecko" <sergej.jurecko@REDACTED>
> An: "Jörg Maushake" <joerg.maushake@REDACTED>
> Cc: "Gokhan Boranalp" <kunthar@REDACTED>, Erlang <erlang-questions@REDACTED>
> Betreff: Re: [erlang-questions] windows multicast
>
> You probably can’t listen on the same port from two erlang instances.
> 
> Sergej
> 
> On 11 May 2014, at 13:25, Jörg Maushake <joerg.maushake@REDACTED> wrote:
> 
> > Thank You for this detailled reply.
> > Does your windows code work on two nodes started on one machine?
> > On my machine im still getting eaddrinuse when trying to run the code in two nodes.
> > I did the following, to verify the code used for windows:
> > 
> >  Mc = {230, 0, 0, 1},
> >  Src = {192,168,2,101},
> >  %% 1> inet:getiflist().
> >  %% {ok,["169.254.82.58","192.168.2.101","127.0.0.1"]} 
> >  %% 2>
> >  Opts = [ { active, true },
> >           { ip, Src },
> >           { multicast_loop, true },
> >           { reuseaddr, true },
> >           list 
> >         ],
> >  { ok, RecvSocket } = gen_udp:open (Port, Opts),
> >  inet:setopts(RecvSocket, [{ add_membership, { Mc, Src }}]),
> > 
> >  And it works when starting a node. But when starting another node (on the same maching) im still getting
> >  Address in use:
> > 
> > !! eaddrinuse 
> > 
> >  im using R16B03-1
> > 
> > 
> >> Gesendet: Sonntag, 11. Mai 2014 um 07:55 Uhr
> >> Von: "Sergej Jurecko" <sergej.jurecko@REDACTED>
> >> An: "Jörg Maushake" <joerg.maushake@REDACTED>
> >> Cc: "Gokhan Boranalp" <kunthar@REDACTED>, Erlang <erlang-questions@REDACTED>
> >> Betreff: Re: [erlang-questions] windows multicast
> >> 
> >> Multicast in erlang is kind of weird. 
> >> 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. 
> >> 
> >> Mc = multicast address
> >> Src = source ip of local interface
> >> 
> >> Windows:
> >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Src}, {multicast_ttl, 1}, {multicast_loop, false}, binary]),
> >> inet:setopts(SockSrc, [{add_membership, {Mc, Src}}]);
> >> 
> >> linux,freebsd:
> >> 
> >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, {0,0,0,0}}, {add_membership, {Mc, Src}},{active,true}, binary,{recbuf, 1024*1024}]);
> >> 
> >> osx:
> >> 
> >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Mc}, {multicast_ttl, 1}, {multicast_loop, false},{recbuf, 1024*1024}, binary]),
> >> inet:setopts(SockSrc, [{add_membership, {Mc, {0,0,0,0}}}])
> >> 
> >> 
> >> Sergej
> >> 
> >> On 10 May 2014, at 21:37, Jörg Maushake <joerg.maushake@REDACTED> wrote:
> >> 
> >>>  Restarting windows does not change anything.
> >>>  I deployed the code to macbook where it works.
> >>>  It seems to be a windows issue
> >>>  otp_release: R16B03-1
> >>> 
> >>> Gesendet: Samstag, 10. Mai 2014 um 17:18 Uhr
> >>> Von: "Gokhan Boranalp" <kunthar@REDACTED>
> >>> An: "Jörg Maushake" <joerg.maushake@REDACTED>
> >>> Cc: Erlang <erlang-questions@REDACTED>
> >>> Betreff: Re: [erlang-questions] windows multicast
> >>> Restart your computer.
> >>> 
> >>> On Sat, May 10, 2014 at 5:58 PM, "Jörg Maushake" <joerg.maushake@REDACTED> wrote:
> >>>> Hi list,
> >>>> I am using erlang on windows 7.
> >>>> 
> >>>> When i start a multicast (the code is from nodefinder) like so:
> >>>> Opts = [ { active, true },
> >>>> { ip, {230, 0, 0, 1} },
> >>>> { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } },
> >>>> { multicast_loop, true },
> >>>> { reuseaddr, true },
> >>>> list
> >>>> ],
> >>>> { ok, RecvSocket } = gen_udp:open (4321, Opts),
> >>>> 
> >>>> i get this {error,eaddrnotavail}
> >>>> 
> >>>> Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work!
> >>>> But when i then start another node on the same machine the error i get is:
> >>>> {error,eaddrinuse}
> >>>> 
> >>>> (The multicast group and port works with java )
> >>>> 
> >>>> Any suggestions ?
> >>>> 
> >>>> _______________________________________________
> >>>> erlang-questions mailing list
> >>>> erlang-questions@REDACTED
> >>>> http://erlang.org/mailman/listinfo/erlang-questions
> >>>> 
> >>> 
> >>> 
> >>> 
> >>> --
> >>> BR,
> >>> \|/ Kunthar
> >>> _______________________________________________
> >>> erlang-questions mailing list
> >>> erlang-questions@REDACTED
> >>> http://erlang.org/mailman/listinfo/erlang-questions
> >> 
> >> 
> 
>



More information about the erlang-questions mailing list