Great @mdma should have guessed it is you. I found the following function:
wiced_interface_t interface, const wiced_ip_address_t* address);
(There is also the corresponding leave function, which will ignore for the discussion).
This will subscribe to a multicast address on the IGMP level. It seems that all UDP sockets will then receive multicast packets sent to their respective ports.
What I did is to add a
int socket_join_multicast(const sockaddr_t *addr);
function to socket_hal. This is then used in
int udp_join_multicast(IPAddress ip);
in spark_wiring_udp. So far so trivial. I am unsure if that is the right location (it is, I think) and if it should be a static function of the UDP class or a free function.
Here is a simple test program which you can put on as many Photons as you like and they will all start flashing the blue LED. The more Photons, the faster they will flash :-).
static UDP g_udp;
static int g_last = 0;
IPAddress address(224, 1, 2, 3);
int result = udp_join_multicast(address);
if (g_udp.parsePacket() > 0)
// Read first char of data received
unsigned char v = g_udp.read();
Serial.print("Received packet ");
int now = millis();
if (now - g_last < 1000)
g_last = now;
unsigned char v = 42;
IPAddress ipAddress(224, 1, 2, 3);
We should of course add the leave function as well. What do you think?