Unicast vs. Broadcast

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Unicast vs. Broadcast

392 次查看
theJoel
Contributor III

Hi,

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...

Cheers,

+Joel.

标签 (1)
标记 (4)
0 项奖励
0 回复数