Zeroconf/bonjour 实施需要多个套接字吗?

发布于 2024-11-26 14:18:55 字数 133 浏览 0 评论 0原文

实施 Zeroconf/bonjour 是否需要多个套接字?我正在固件上实现 bonjour,但我的芯片仅支持一个插槽。

在我看来至少有两个是必要的: - 一个套接字来监控多播查询和公告 - 至少多一个套接字来解析并连接到客户端

Is more than one socket required to implement Zeroconf/bonjour? I'm implementing bonjour on firmware and my chip only supports one socket.

Seems to me at least two would be necessary:
- One socket to monitor the multicast queries and announcements
- At least one more socket to resolve and connect to clients

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

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

发布评论

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

评论(2

不语却知心 2024-12-03 14:18:55

引用 rfc

When this document uses the term "Multicast DNS", it should be taken
to mean: "Clients performing DNS-like queries for DNS-like resource
records by sending DNS-like UDP query and response packets over IP
Multicast to UDP port 5353."

要完全实现 mDNS (Bonjour),您需要绑定到 224.0.0.251(保留的 IPv4 地址)的开放套接字和开放接收查询的端口 5353。

显然,这仅仅涵盖了 Zeroconf 的实现——无论您宣传什么服务,都将需要更多的端口和网络。插座打开。

To quote the rfc:

When this document uses the term "Multicast DNS", it should be taken
to mean: "Clients performing DNS-like queries for DNS-like resource
records by sending DNS-like UDP query and response packets over IP
Multicast to UDP port 5353."

To fully implement mDNS (Bonjour), you need an open socket bound to 224.0.0.251 (the reserved IPv4 address) and port 5353 open to receive queries.

Obviously this just covers the Zeroconf implementation- whatever service you're advertising will require more ports & sockets open.

迷途知返 2024-12-03 14:18:55

根据您想要实现的目标,您可以使用套接字来侦听多播服务公告,选择一个服务(例如,向用户提供列表),关闭套接字,然后重新使用它来连接到该服务。如果您已经选择了一项服务,则无需继续收听服务公告,并且如果您正在使用的服务已撤回(例如提供该服务的设备已关闭),则您可以返回收听组播寻找替代方案。

Depending on what you're trying to achieve, you can use the socket to listen for multicast service announcements, pick a service (e.g. offer a list to the user), close the socket then reuse it to connect to the service. You don't need to keep listening to service announcements if you've already chosen one to choose, and if the service you're using is withdrawn (e.g. the device supplying it is turned off) then you can go back to listening to multicast to find an alternative.

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