[erlang-questions] Struggling with multicast udp send

Jarrod Roberson <>
Mon Nov 16 07:26:12 CET 2009

On Mon, Nov 16, 2009 at 12:41 AM, Rapsey <> wrote:

> This is copy paste from my server:
> Dest and Source are IP addresses (Source is IP of local computer, can be
> {0,0,0,0})
> {ok, Sock} = gen_udp:open(0, [{reuseaddr,true}, {ip, Source},
> {multicast_ttl, P#tspar.ttl},
>                                                 {multicast_loop, false},
> binary]),
> inet:setopts(Sock, [{add_membership, {Dest, Source}}]);

Thanks, but that works great for listen, but I can't get it to work for
Also I don't want to pass in 0 for the port, that gives me a random port, I
want to use port 5353.
All the other programs can send on that port, why can't erlang?
here is the output I get from iChat starting up.

From: {192,168,0,105}
Port: 5353

I get similar results with the exact same port 5353 from SubEthaEdit and

here is what I get when I try and send the message.

From: {192,168,0,105}
Port: 57345
Data: {error,fmt}

that is with passing in ZERO for the port on the :open() call.

and here is what I get when I try and make it send on 5353 like the other

44> l(zcquery).
45> zcquery:send().
** exception error: no match of right hand side value {error,eaddrinuse}
     in function  zcquery:send/0

anyone have any arcane knowledge of how to get this to behave correctly?

More information about the erlang-questions mailing list