This is probably because of a dumb error on my part, but I'm having a hard time broadcasting a UDP datagram. Here's the basic code I'm using:
auto connection = listenUDP(0, "255.255.255.255");
scope(exit) connection.close();
connection.canBroadcast = true;
connection.send([1, 2, 3]);
When I fire up GDB, I see that the Linux socket send() function is producing an errno of 89 (Destination address required). I've tried several different broadcast addresses (192.168.x.255, 0.0.0.0), and I've also tried using the connection.send(data, address)
variant, which produces errno 22 (Invalid argument). I'm using the default libevent2 backend on Arch Linux x86_64.
Is there a bug in my code, or do I need to dig deeper?
Thanks!