I am trying to send UDP frames to an MQX system using broadcast messages.
The MQX system has a DHCP assigned IP address of 192.168.0.5 and a netmask of 255.255.255.0.
- UDP frames sent to 192.168.0.5 are rx ok
- UDP frames sent to 255.255.255.255 are rx ok
- UDP frames sent to 192.168.0.255 are not rx
Sniffing the wire, both the 255.255.255.255 and 192.168.0.255 frames are sent with a destination MAC address of ff:ff:ff:ff:ff:ff as expected.
RTCS IP statistics show the UDP frames sent to 192.168.0.255 are being discarded.
This seems broken. I have a different platform (non-MQX) where is works.
Is there a setting that I'm overlooking?
My code looks like this:
struct sockaddr_in any;
udp_ethernet = socket(PF_INET, SOCK_DGRAM, 0);
any.sin_family = AF_INET;
any.sin_port = MY_PORT;
any.sin_addr.s_addr = INADDR_ANY;
bind(udp_ethernet, &any, sizeof(any));
rlen = sizeof(raddr);
memset(&raddr, 0, rlen);
len = recvfrom(udp_ethernet, data, DATA_LEN, 0, &raddr, &rlen);
Thanks
Tom