Unabke to read UDP broadcast with destination address of 0.0.0.0

I am trying to read a UDP broadcast from an application using windows sockets.The broadcast messages are from a network device. WireShark confirms that the windows computer is receiving the UDP packets. The socket application does not receive any messages. WireShark indicates that the udp destination is 0.0.0.0. If I generate a UDP packet with with a destination address of 255.255.255.255 the socket application sees it. The UDP is using port 67, the messages are BootP. Code is similar to bootp server example in  "the code project" site.
bmark_caAsked:
Who is Participating?
 
nociSoftware EngineerCommented:
Yes, indeed. As a bootp/dhcp client doesn't know it address/network etc. It has to assume the all networks broadcast  (255.255.255.255).

The RFC (description of DHCP is:)
http://www.faqs.org/rfcs/rfc2131.html

Which for a client request refers to the BOOTP rfc:
http://www.faqs.org/rfcs/rfc951.html

Which in chapter 3 specifies that for the DHCPDISCOVER packet from client to server the sourceadress must be 0.0.0.0 and that the server address if unknown must be 255.255.255.255.
0
 
nociSoftware EngineerCommented:
The requirement for bootb/dhcp (port 68/67 depending on client/server resp.) is that the target is the broadcast address for a discovery packet. So a target address of 0.0.0.0 is incorrect.
That wireshark sees the packet just means that wireshark puts the interface in promiscous mode (i.e. receive anything) ==> sees anything that lands on your cable or switch/hub-port, including packets like Bridge PDU's etc. that are filtered by the interface.
While an application requests for specific addresses (see bind() socket API call), the IP stack filters "invalid" packets too.

A broadcast is either: 255.255.255.255 or the highest address in your network... say your network is 192.168.111.0/24 broadcast 192.168.111.255
this causes the IP stack to use the FF:FF:FF:FF:FF:FF (or Broadcast MAC-address to be used).
A broadcast with 0.0.0.0 "shouldn't happen", at least not for bootp/dhcp.
0
 
bmark_caAuthor Commented:
The device I am trying to communicate with is a ptototype and the destination address "0.0.0.0" must be an error. I have an email out to the makers. Thanks for the confirmation.
0
 
bmark_caAuthor Commented:
Addition of reference makes solution even better
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.