Ethernet receive UDP multicast

Hi there

I'm trying to receive art-net messages on my arduino with ethernet shield. But i have some problems receiving multicasted udp packets. The thins is, art-net is supposed to either be on the 2.0.0.0/8 or 10.0.0.0/8 ip range, and not the standard 192.x.x.x. When i try to multicast some messages manually from processing, and my arduino and computer is set to 192.x.x.x ip range, then multicasting (to 192.x.x.255) works fine, but when i set my computer to 2.0.0.3 for example, and arduino 2.0.0.4, and multicast (to 2.255.255.255), then my arduino does not receive the messages (although the RX blinks). The subnet is set to 255.0.0.0 (but i've also tried other subnets). I'm very new in all this ip range shit, so i might just be stupid! But anybody knows something about this? I can't really change the senders way of multicasting, since i'm hooking up to a big expensive lighting desk (GrandMA).

Jonas Jongejan

In order to communicate over IP you need an IP address, subnet mask, AND A GATEWAY ADDRESS.

If you specify a manual IP address in Ethernet.begin() and don't specify a gateway address it will assume the gateway (router) has the same first three octets as your Arduino and with a fourth octet of '1'. In your example of the Arduino using 2.0.0.4 it would assume the router is at 2.0.0.1. Is that a correct assumption?

I'm not really sure what else to set it to? There is no router in the system (its just a cat5 cable between arduino and lighting desk / computer). So are there other meaningful ip addresses to set the gateway to? And could that influence the multicast problem?

Right now my feeling is that multicasting on 2.0.0.0/8 and 10.0.0.0/8 networks doesn't work on arduino!

If you don't have a router in the system you should probably specify the PC as the gateway.

Ethernet.begin(MAC address, IP address, DNS server address, gateway address, subnet);

To specify the gateway you have to also specify the DNS server address. It's not needed if you are using only IP addresses and not domain names but it has to be there. Might as well set it to the same as the gateway (PC) address.

First of all, multicasting is not the same as broadcasting. It sounds like you're actually wanting broadcasting, not multicasting.

Multicast requires the use of proper multicast addresses. These addresses frequently initiate special case logic for routers and switches. Without the use of these addresses and/or a proper subscription, many switches will not pass multicast traffic.

Also, in order to receive multicast, you should be subscribing on the receiver side of things. This typically requires a special ioctl operation. Furthermore, whatever IP stack you're using MUST support multicasting because multicast uses special MAC addresses. And if your NIC is not looking to accept/filter those MAC addresses (which is frequently configured via subscription), multicast datagrams will simply be dropped on the floor and/or ignored.

Generally speaking, multicast is fairly involved and complex. Unless you're absolutely sure you require multicast, I encourage you to simply broadcast.

BTW, just so I don't further confuse things, your Network Interface Card (NIC) will still use a regular address, NOT a multicast address.

So for example, your NIC will have IP 192.168.1.10, netmask 255.255.255.0, and gateway 192.168.1.1. DNS will be whatever is right for your network; though might be the same as your gatway (as above, 192.168.1.1). You will then subscribe to a multicast address/port and/or directly send to a multicast address/port.

So long as you have a computer in the mix, I encourage you to get an application called, "Wire Shark". When you run it, it will place your NIC into promiscuous mode, sniffing the network traffic which it can see. Please note switches can and do directly affect what is observable on a given switch port.