无法打开多播套接字

发布于 2024-08-14 21:09:53 字数 278 浏览 5 评论 0原文

我在 Erlang 中打开多播套接字来接收消息时遇到问题:

88> gen_udp:open(5353,[{reuseaddr, true}, {ip,{224,0,0,251}},{multicast_ttl,4},{multicast_loop,false},binary]).
{error,eaddrnotavail}

我检查了不同的 IP 地址和端口以及选项 {active, false},但没有任何帮助。可能是什么原因?

谢谢,马蒂亚斯。

I have problems to open an multicast socket in Erlang to receive messages:

88> gen_udp:open(5353,[{reuseaddr, true}, {ip,{224,0,0,251}},{multicast_ttl,4},{multicast_loop,false},binary]).
{error,eaddrnotavail}

I checkt diffrent IP addresses and ports and the option {active, false}, but nothing helps. What could be the reason?

Thanks, Matthias.

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

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

发布评论

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

评论(1

蘸点软妹酱 2024-08-21 21:09:53

您是否尝试添加选项 {add_membership, {Addr, LAddr}} 其中:

  1. Addr 是有问题的多播组(例如 224.0.0.251)
  2. LAddr 是本地接口(例如 0.0.0.0 为默认值)一)

1> gen_udp:打开(5353,[{reuseaddr,
真}, {add_membership, {{224, 0,0,
251}, {0, 0, 0, 0}}},
{ip,{224,0,0,251}},{multicast_ttl,4},{multicast_loop,false},binary])。

{ok,#端口<0.454>}

Have you tried adding the option {add_membership, {Addr, LAddr}} where:

  1. Addr is the multicast group in question (e.g. 224.0.0.251)
  2. LAddr is a local interface (e.g. 0.0.0.0 for the default one)

1> gen_udp:open(5353,[{reuseaddr,
true}, {add_membership, {{224, 0,0,
251}, {0, 0, 0, 0}}},
{ip,{224,0,0,251}},{multicast_ttl,4},{multicast_loop,false},binary]).

{ok,#Port<0.454>}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文