Unicast vs. Broadcast

Showing results for 
Search instead for 
Did you mean: 

Unicast vs. Broadcast

Contributor III


If we bind to an IP of INADDR_ANY, is there a way to determine if the destination IP (of a UDP datagram) was a unicast or a broadcast?

My current solution is to open 2 sockets, one bound to the specific IP and one bound to INADDR_ANY. I can wait on both sockets and recv() from the appropriate one. However, this doubles my memory requirement and makes it more painful to add DHCP capabilities to the product.

Does anyone have a solution with a single socket? I don't mind tinkering or implementing a custom "get dest IP" function.

Also any tips on doing dhcp when binding to a specific IP and not INADDR_ANY would be welcome...



Labels (1)
0 Kudos
0 Replies