Sorry, gentle reader, this one’s a bit technical.
I was reusing some of the code Apple supply for sending UDP packets between servers, but the system I’m working with listens for broadcast packets. I set it up to use the address 255.255.255.255, but got the EACCESS error: Permission denied
I found an example that did work (without using Apple’s CFSocket class) and did a line by line what’s different. You need this to do broadcast
int ret=setsockopt(sd, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable));