I am struggling with two executables that I have built, which should communicate over multicast. In my current setup they should communicate over the loopback device. For this I have executed two commands before starting anything:
ifconfig lo multicast
route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
My sending application does roughly this, in this order:
getaddrinfo
socket
setsockopt(IP_MULTICAST_LOOP)
connect
My listening application does roughly this, in this order:
getaddrinfo
socket
connect
setsockopt(IP_ADD_MEMBERSHIP)
When the two programs run, the wlan0
interface is also up besides lo
.
My listening application receives nothing when I have the route towards 224.0.0.0
enabled, but tcpdump does . When I remove that route and restart the listening application everything works fine.
I wonder what steps I can take to debug this? It appears as if my sending application is always sending over the wlan0
interface.
Changing the code to use send
and recv
fixed the issue for me.