I need to send a UDP Broadcast to the network connected to my device from an Container running as a module inside the Azure IoT Edge Runtime.
I've exported my udp port in the module configuration
{
"ExposedPorts": {
"7808/udp": {}
},
"HostConfig": {
"PortBindings": {
"7808/udp": [
{
"HostPort": "7808"
}
]
}
}
}
Unicasts work fine. But i can't send a Broadcast to the outside world.
I've already tried to use the devices dedicated network broadcast IP without success.
Sample Code:
// initialize UdpClient
var ep = new IPEndPoint(IPAddress.Any, SharedPort);;
var _exclusiveConn = new UdpClient { ExclusiveAddressUse = true };
_exclusiveConn.Client.Bind(ep);
_exclusiveConn.EnableBroadcast = true;
// send
_exclusiveConn.Send(buffer, bufferlength, ep);
Code: