Send UDP broadcast on Windows 7

前端 未结 1 1850
鱼传尺愫
鱼传尺愫 2020-12-18 08:08

I have a PC with two network cards connected to different networks (multi homed network setup). I want to send UDP broadcast frames on both networks. The senders IP address

相关标签:
1条回答
  • 2020-12-18 08:22

    Can't you just open two normal UDP sockets and bind one to each of the interface addresses and then simply send to the broadcast addresses ?

    This will, as far as I know, deal with the sending on both networks and it will ensure that the packets sent will have the correct ip address. It wont work if you bind a single socket to INADDR_ANY which, of course, WILL work if there's only a single network adapter in the machine. To create a complete solution it's probably best to iterate over the available addresses and create a socket for each, bind to each and send from each.

    0 讨论(0)
提交回复
热议问题