Search code examples
socketsbonjourzeroconf

Multiple sockets required for Zeroconf/bonjour implementation?


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


Solution

  • 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.