Cannot send multicast packets from ConnectPort X4

I cannot get UDP multicasting to work from the X4 using DigiPython (DigiESP for Python), Python 2.4.3.

I have verified that my network and firewall settings are correct by writing simple multicast send/receive programs in another language confirming that all computers on the LAN can act as both multicast sender or reciever.

The ConnectPort X4 is not acting as a LAN router; it’s just a LAN client so it’s not responsible for the multicasting, just sending out the originating packets. I have attached a Python example that demostrates basic UDP multicast.

This example works as expected (sends multicast packets) when run from the host computer using the “Run As -> Python Run” option, but does not work as expected when from the X4 using the “Run As -> Remote Digi Python Application”. It appears to run normally without errors, but, as far as I can tell, no packets are being sent (or at least they are not being received from any computer on the LAN).

Note that TCP sockets work exactly as expected, as demonstrated in the tcp_zig_dynamic_mapping example). I have not tried unicast UDP. I need multicast UPD in this case.

– James –

I tried your example on a ConnectPort X2D and it worked fine - via a HUB (not switch) my PC+wireshark was able to see the UDP multicasts from the X2’s IP of 192.168.196.102 to 224.1.1.1 fine.

I think this is a switch/IGMP issue. Notice that I used a HUB not a SWITCH.

I see that other multicast examples use socket.IP_ADD_MEMBERSHIP, which I assume means it causes the IP stack to issue the IGMP joins to notify the switch to join the group being sock.bind() to. I know the Digi stack supports MC and IGMP - Digi uses it for the ADDP/discovery protocol.

I do NOT know that the Python 2.4.3 socket allows the setsockopt for socket.IP_ADD_MEMBERSHIP, but you’d only need this to receive your own MC in Python.

I assume a switch will auto-join an out-bound Class D group. However, your PC (any device) will NOT detect any in-bound multicast if you have not correcty used IGMP to tell the switch to forward that group to you. Old hubs don’t care (& you can still buy ultra-cheap 10M 5-port hubs at BestBuy).

The PC would automatically detect (in wireshark, etc) it’s own Class D multicasts since it is cheating and pulling that info from the localhost with no MAC-filtering switch interference.

lynnl, thanks very much for taking the time to test this out on the X2.

I’ve tested both sending and receiving from several PCs. If this were an issue with any part of the network (router, hubs, etc.), it would have been revealed as part of this test. Even so I might dig out an old hub or router and build a mini network for testing.

As you say, socket.IP_ADD_MEMBERSHIP is only necessary for receiving MC. My receiving app is not python, and in any case isalready tested and working. I only need the X4 to send in this case. I cannot verify that it’s even trying to send MC packets. It definitely works as expected with TCP packets.

I can rework my code to just use TCP sockets if necessary, but it’s not the ideal arrangement for what I’m building.

Again, thanks for checking. I’m going to keep poking around.

– James –

Update: After additional testing, it’s still not working.

As an experiment, I dug out an old router and connected a laptop and the X4 to it, to remove all of the main network from the equation. Same result: X4 appears to send but nothing is received on the laptop.

While I need the X4 to send multicast, as an experiment I tested whether it can receive multicast. It cannot. I’ve attached an example ReceiveMultiCast.py example that works when run on the local PC using “Run as -> Python Run” from Digi ESP, and it successfully receives multicast packets (sent from another PC) as expected. But when the same code is run from the X4, there is an error:

(128, ‘Socket is not connected’)

Just as with the multicast send case, code that works from the PC does not work from the X4, and I am now convinced that the X4 is not capable of working with UDP multicast. If anyone using an X4 finds results to the contrary, either with your own code or with the examples I’ve posted, I would appreciate knowing about it.

– James –