255.255.255.255
is not the best option for sending UDP broadcasts, and some routers/firewalls do block it unless configured otherwise. The better option is to use the NIC's actual subnet broadcast IP instead. For example, if a UDP socket is bound to local IP 192.168.0.1
with a subnet mask of 255.255.255.0
, then the broadcast IP for that subnet is 192.168.0.255
.
Most platforms have OS-specific APIs for retrieving a NIC's actual broadcast IP, such as getifaddrs()
on POSIX systems, or at least for retrieving the NIC's subnet mask, such as GetAdaptersInfo()
and GetAdaptersAddresses()
on Windows, so you can calculate the broadcast IP manually.
Retrieving the local broadcast IP(s) may be added to Indy in a future version.