Zeroconf/bonjour 实施需要多个套接字吗?
实施 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
引用 rfc:
要完全实现 mDNS (Bonjour),您需要绑定到 224.0.0.251(保留的 IPv4 地址)的开放套接字和开放接收查询的端口 5353。
显然,这仅仅涵盖了 Zeroconf 的实现——无论您宣传什么服务,都将需要更多的端口和网络。插座打开。
To quote the rfc:
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.
根据您想要实现的目标,您可以使用套接字来侦听多播服务公告,选择一个服务(例如,向用户提供列表),关闭套接字,然后重新使用它来连接到该服务。如果您已经选择了一项服务,则无需继续收听服务公告,并且如果您正在使用的服务已撤回(例如提供该服务的设备已关闭),则您可以返回收听组播寻找替代方案。
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.