Specifying what network interface an UDP multicast should go to in .NET(在 .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 多播应该转到的网络接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 .NET 中指定 UDP 多播应该转到的网络接口
基础教程推荐
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
