[erlang-questions] UDP multicast on Raspberry Pi

Rad Gruchalski <>
Sat May 16 15:30:13 CEST 2015


Unfortunately, I get exactly the same result.  

No data received on RPi when using multicast group.
It’s very strange as data published over multicast from RPi arrives at the destination. Only RPi isn’t getting any data.
Just to make sure I was not having any general UDP issues - this is is the no multicast server running on RPi:

-module(udp_nomulticast).

-behaviour(gen_server).

-export([start_link/0, stop/0]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, code_change/3, terminate/2]).

start_link() ->
  gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).

stop() -> gen_server:cast(?MODULE, stop).

init([]) ->
  Port = 6666,
  IfaceIp = {0,0,0,0},
  {ok, OverlaySocket} = gen_udp:open(Port, [ binary,
                                             {ip, IfaceIp} ] ),
  { ok, OverlaySocket }.

handle_info({udp, _ClientSocket, _ClientIp, _ClientPort, Msg}, State) ->
  error_logger:info_msg("Received multicast data: ~p", [ Msg ]),
  {noreply, State}.

handle_call( _, _From, State) ->
  { reply, ok, State }.

code_change(_OldVsn, State, _Extra) ->
  {ok, State}.

terminate(_, _) ->
  ok.

handle_cast(stop, LoopData) ->
  {noreply, LoopData}.


And the client sending to it from the dev box (RPi IP on the local network is 10.128.30.23):

-module(nmcc).

-export([run/0]).

run() ->
  Port = 6666,
  IfaceIp = {0,0,0,0},
  RPiIp = {10,128,30,23},
  {ok, OverlaySocket} = gen_udp:open(Port, [ binary,
                                             {ip, IfaceIp} ] ),
  gen_udp:send( OverlaySocket, RPiIp, Port, <<"some random datas">> ),
  gen_udp:close( OverlaySocket ).


This is arriving just fine:

 ~ $ erl
Erlang/OTP 17 [erts-6.4] [source] [smp:4:4] [async-threads:10] [kernel-poll:false]

Eshell V6.4  (abort with ^G)
1> c("udp_nomulticast").
{ok,udp_nomulticast}
2> udp_nomulticast:start_link().
{ok,<0.40.0>}
3>
=INFO REPORT==== 16-May-2015::15:05:35 ===
Received multicast data: <<"some random datas”>>


I’m often jumping too fast to conclusions but I genuinely believe this could be some Erlang related problem but I am not sure how to diagnose it.

I tried multiple combinations, binding the server to {0,0,0,0} or multicast IP, different multicast groups. Result is always the same, traffic not arriving at RPi when using multicast UDP. What’s the best way to elevate? File a bug?










Kind regards,

Radek Gruchalski

 (mailto:)
 (mailto:)
de.linkedin.com/in/radgruchalski/ (http://de.linkedin.com/in/radgruchalski/)

Confidentiality:
This communication is intended for the above-named person and may be confidential and/or legally privileged.
If it has come to you in error you must take no action based on it, nor must you copy or show it to anyone; please delete/destroy and inform the sender immediately.



On Saturday, 16 May 2015 at 08:25, Max Lapshin wrote:

> Replace  {ip, MulticastIp},  with {ip, IfaceIp},
>  
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150516/6228875b/attachment.html>


More information about the erlang-questions mailing list