Size_t nBytes = sendto(sock, msg, strlen(msg), 0, If( setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast)) != 0 ) If( (sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) = -1) So basically this example code WORKS on Fedora 19 in a test environment (on a larger network where I have DHCP enabled), until I try to statically set my IP address: int main(int argc, char *argv) There is no router on the network, just a simple switch between my machine and the box I'm trying to talk to, plus a couple other Linux machines on the network. But, I can't seem to broadcast off my own subnet unless I'm using DHCP, which ultimately I won't be able to do. I need to send a broadcast packet to a piece of hardware which, when it powers up, is on a different subnet than my machine, in order to tell it to reset its IP address to one that's on my network. First time poster, hopefully this is an easy one:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |