Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  Windows UDP multicast receive

gregory
Posted: Tue Jun 24, 2008 2:40 pm Reply with quote
Joined: 24 Jun 2008 Posts: 1
Hello

Absolute Erlang newbie here, trying to do a UDP multicast receive on Windows as a useful/interesting test case for my purposes.

Version is: Erlang (BEAM) emulator version 5.6.3 [smp:2] [async-threads:0]

Below is my code - What I am trying to do is listen on "address" 224.0.66.66 "port"6666.
My computer's regular IP address is 192.168.6.49 on our internal network.

The code "runs" ok, but never seems to receive anything, I always get the "huh" output, and I know from other handlers that there are all sorts of packets flying by on this multicast address.

Help?!

Abject and humble apologies if this is the wrong forum.

Scott

Code:

-module(listen).
-export([init/0, loop/1]).

loop(Socket) ->
        io:format("in-loop~n"),
        receive
                {udp, Socket, Host, Port, Bin} ->
                        io:format("host",Host),
                        io:format("Port: ", Port),
                        io:format("BinSize: ", size(Bin)),
                        loop(Socket);
                {udp, _ } ->
                        io:format("got one")
        after 2000 ->
                io:format("huh?~n")
        end,
        gen_udp:close(Socket).


init() ->
        {ok, Socket} = gen_udp:open(6666, [binary,
                                        {reuseaddr,true},
                                        {multicast_loop,true},
                                        {ip,{192,168,6,49}},
                                        {add_membership,{{224,0,66,66},{192,168,6,49}}}]),
        loop(Socket).
View user's profile Send private message
francesco
Posted: Wed Jul 09, 2008 9:29 am Reply with quote
User Joined: 07 Jul 2006 Posts: 249 Location: London
Have you looked at your firewall and security settings? They always catch us out on Windows.

Francesco
View user's profile Send private message Visit poster's website

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum