How can I receive broadcasts to 255.255.255.255?
Posted on 2004-04-12
I am investigating writing a DHCP server to run under Win2K & WinXP. I have so far implemented a partly-successful packet sniffer under Winsock2, using a socket configured with the SOCK_RAW and SIO_RCVALL options. I was surprised to discover that the SIO_RCVALL option does not actually return all packets on the network: It appears to return only those packets which were successfully received by a machine on the network. (This was revealed when I could sniff DHCP client/server conversations, but could no longer see the DHCP requests when the DHCP server was removed from the network).
So I can't use just SIO_RCVALL to catch incoming DHCP requests while implementing a DHCP server.
I attempted to add the DHCP broadcast address of 255.255.255.255 to my adapter's list of IP addresses, but Windows 2000's Advanced TCPIP settings dialog does not allow this address, instead popping up an error dialog stating, "255 is not a valid entry. Please specify a value between 1 and 223."
So who can tell me how to either a); receive these packets using another parameter besides SIO_RCVALL, or b); get the needed 255.255.255.255 broadcast address into my adapter's address list without having to write a device driver?
(If someone can authoritatively answer that the only way to do this is to write or modify a device driver, I will of course have to accept it as an answer if no other answer appears).