多播绑定接口问题

发布于 2024-12-13 14:27:25 字数 123 浏览 1 评论 0原文

我有一个我很困惑的问题。 例如,如果我想加入多播组239.255.0.1:30001来接收数据。我应该绑定到哪个接口?我看到有人说绑定到多播地址239.255.0.1:30001。绑定到本地机器接口(如 eth0/eth1)怎么样?

I have an issue which I am confused.
for example, if I want to join a multicast group 239.255.0.1:30001 to receive data. which interface should I bind to? I saw some people say to bind to that multicast address 239.255.0.1:30001. how about binding to the local machine interface such as eth0/eth1?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪冰清 2024-12-20 14:27:25

这取决于您的目标操作系统。

  • 对于 Windows,绑定到本地计算机接口
  • 对于 Linux 和 Linux, 绑定到本地计算机接口Mac/iOS(可能还有 BSD 风格套接字的其他用户),绑定到多播地址
  • 对于可以在 Windows 和 Windows 上工作的代码Linux,绑定到 INADDR_ANY (0)。请注意,您可能必须过滤掉不需要的流量。此外,这不适用于 Mac/iOS。

It depends on the OS you're targetting.

  • For Windows, bind to the local machine interface
  • For Linux & Mac/iOS (and possibly other users of BSD-style sockets), bind to the multicast address
  • For code that'll sort of work across both Windows & Linux, bind to INADDR_ANY (0). Note that you might then have to filter out unwanted traffic. Also, this won't work on Mac/iOS.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文