Unicast vs. Broadcast

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Unicast vs. Broadcast

1,064件の閲覧回数
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 返答(返信)