在 .NET 中指定 UDP 多播应该转到的网络接口 [英] Specifying what network interface an UDP multicast should go to in .NET

查看:22
本文介绍了在 .NET 中指定 UDP 多播应该转到的网络接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在具有活动无线网卡和 LAN 端口的计算机上,通过交叉电缆连接到运行相同应用程序的另一台计算机,我们需要通过 LAN 线向另一台计算机发送 UDP 多播.使用 C# 套接字,Windows 似乎每次都尝试通过 WLAN 适配器路由消息.

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 multicast over the LAN wire to the other computer. Using C# Sockets, Windows seems to try to route the message over the WLAN adapter every time.

有没有办法指定在哪个网络接口上发送 UDP 多播?

Is there a way to specify what network interface to send a UDP multicast on?

推荐答案

您可能正在寻找 SocketOptionName.MulticastInterface.这里是 MSDN 上的一篇文章,可能会对您有所帮助.

You are probably looking for SocketOptionName.MulticastInterface. Here's an article on MSDN that might help you.

除此之外,如果您更新本地路由表以具有与多播地址匹配并指向正确接口的确切条目,它应该可以正常工作.

Other then that if you update your local routing table to have an exact entry matching the multicast address and pointing to the right interface it should just work.

这篇关于在 .NET 中指定 UDP 多播应该转到的网络接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆