[erlang-questions] Struggling with multicast udp send

Rapsey rapsey@REDACTED
Mon Nov 16 06:41:06 CET 2009


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}}]);


Sergej

On Mon, Nov 16, 2009 at 6:04 AM, Jarrod Roberson <jarrod@REDACTED>wrote:

> here is what I am trying, it doesn't work. :-(
>
> send() ->
>    {ok, S} = gen_udp:open(5353, [{reuseaddr,
> true},{ip,{224,0,0,251}},{broadcast, true}]),
>    inet:setopts(S,[{add_membership,{{224,0,0,251},{0,0,0,0}}}]),
>    gen_udp:send(S, {224,0,0,251}, 5353, "test").
>
> here is what I get
>
> Erlang R13B02 (erts-5.7.3) [source] [smp:4:4] [rq:4] [async-threads:0]
> [kernel-poll:false]
>
> Eshell V5.7.3  (abort with ^G)
> 1> zcclient:send().
> {error,eaddrnotavail}
> 2>
>
> I know this has to be a simple thing, Programming Erlang has a "broadcast"
> udp example that I am trying to make work.
> I am not sure that is the same thing as "multicast". Is it?
>


More information about the erlang-questions mailing list