Skip to content

Instantly share code, notes, and snippets.

@SaveTheRbtz
Created December 1, 2012 14:10
Show Gist options
  • Save SaveTheRbtz/4182484 to your computer and use it in GitHub Desktop.
Save SaveTheRbtz/4182484 to your computer and use it in GitHub Desktop.
mDNSResponder
Note: Developers writing applications for OS X do not need to incorporate
this code into their applications, since OS X provides a system service to
handle this for them. If every application developer were to link-in the
mDNSResponder code into their application, then we would end up with a
situation like the picture below:
+------------------+ +------------------+ +------------------+
| Application 1 | | Application 2 | | Application 3 |
+------------------+ +------------------+ +------------------+
| mDNS Core | | mDNS Core | | mDNS Core |
+------------------+ +------------------+ +------------------+
| Platform Support | | Platform Support | | Platform Support |
+------------------+ +------------------+ +------------------+
This would not be very efficient. Each separate application would be sending
their own separate multicast UDP packets and maintaining their own list of
answers. Because of this, OS X provides a common system service which client
software should access through the "/usr/include/dns_sd.h" APIs.
The situation on OS X looks more like the picture below:
-------------------
/ \
+---------+ +------------------+ +---------+ \ +---------+
| App 1 |<-->| daemon.c |<-->| App 2 | ->| App 3 |
+---------+ +------------------+ +---------+ +---------+
| mDNS Core |
+------------------+
| Platform Support |
+------------------+
Applications on OS X make calls to the single mDNSResponder daemon
which implements the mDNS and DNS-SD protocols.
Vendors of products such as printers, which are closed environments not
expecting to be running third-party application software, can reasonably
implement a single monolithic mDNSResponder to advertise all the
services of that device. Vendors of open systems which run third-party
application software should implement a system service such as the one
provided by the OS X mDNSResponder daemon, and application software on
that platform should, where possible, make use of that system service
instead of embedding their own mDNSResponder.
See ReadMe.txt in the mDNSPosix directory for specific details of
building an mDNSResponder on a POSIX Operating System.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment