Link to home
Create AccountLog in
Avatar of bmark_ca
bmark_caFlag for Canada

asked on

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.
Avatar of noci
noci

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.
Avatar of bmark_ca

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Addition of reference makes solution even better