Specifying what network interface an UDP multicast should go to in .NET

后端 未结 4 1084
孤独总比滥情好
孤独总比滥情好 2020-12-28 20:26

On a computer with both an active Wireless Card and a LAN-Port with a crossover cable hooked up to another machine running the same application, we need to send a UDP multic

4条回答
  •  轮回少年
    2020-12-28 20:28

    If you are using UDPClient class, then this method forces the IGMP message out of the interface you desire (second parameter), even when binding doesn't work.

    receiveUDPClient.JoinMulticastGroup(IPAddress.Parse("239.254.2.1"), IPAddress.Parse("192.168.6.1"));
    

    Otherwise, MulticastOption(IPAddress, IPAddress) will work. The first parameter is the multicast address, the second address forces a localendpoint you specify to be used.

提交回复
热议问题