[erlang-questions] UDP multicast on Raspberry Pi

Peter Membrey peter@REDACTED
Sat May 16 16:05:16 CEST 2015

Hi Max, 

I'm afraid I don't have a direct answer for your problem, but here's some things that might help you track it down. 

First, after running your Erlang listener run the following command: 

$ netstat -g 

This will show you all of the multicast groups that you are subscribing to and on which interface. Make sure that you see the group you care about in that list. 

If it is in that list, then start a tcpdump session on that interface as root and take a look at what goes on the wire i.e: 

# tcpdump -i <interface name> port <multicast dest port> 

# tcpdump -i eth0 port 10000 

This lot will tell you if your Pi is looking for multicast and whether or not they're hitting the Pi itself. In other words this should help you isolate the problem. 

In addition you can try: 

# tcpdump -i eth0 igmp 

Which should (I'm going from memory) isolate all igmp traffic. You should see packets sent when you join and leave a group. So if you start this command first, then start your Erlang app, you should see an IGMP join going out. 

Hope some of this helps! 

Kind Regards, 

Peter Membrey 

From: "Rad Gruchalski" <radek@REDACTED> 
To: "Max Lapshin" <max.lapshin@REDACTED> 
Cc: "erlang questions" <erlang-questions@REDACTED> 
Sent: Saturday, 16 May, 2015 21:30:13 
Subject: Re: [erlang-questions] UDP multicast on Raspberry Pi 

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: 



-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(_, _) -> 

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

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



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: 

pi@REDACTED ~ $ 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"). 
2> udp_nomulticast:start_link(). 
=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 

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}, 

erlang-questions mailing list 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150516/9254f1f3/attachment.htm>

More information about the erlang-questions mailing list