I see that the latest Edison image is running the mDNS Daemon:
And I am writing some custom code for a service that I would like to be discoverable on the network.
I would like my service to advertise as _rock-finder._tcp.
So my question is, how do I interface from my C/C++ code to the mdnsd daemon to have my service advertised?
Thanks for contacting us!
We appreciate the information provided. We would like to investigate a little bit more and as soon as we find useful information we'll let you know. We'll appreciate your patience during the meantime.
We have been looking for useful information that might help you and we would like to share that with you.
We have found that the package required is avahi (https://linux.die.net/man/1/avahi-publish-service https://linux.die.net/man/1/avahi-publish-service), and we noticed that it is available in the http://alextgalileo.altervista.org/edison-package-repo-configuration-instructions.html AlexT repo, so, you can configure your Edison to fetch packages from that repo following the instructions in the previous link and then use the command opkg install to install the package. Another option would be to include the package in the Yocto image. In the following site, the recipe for it can be accessed: https://github.com/openembedded/openembedded-core/tree/master/meta/recipes-connectivity/avahi https://github.com/openembedded/openembedded-core/tree/master/meta/recipes-connectivity/avahi. Here is another link that we found: https://github.com/lathiat/avahi https://github.com/lathiat/avahi.
We also found general information about mDNS that you could also check just for information purposes:
- http://www.win.tue.nl/~johanl/educ/IoT-Course/mDNS-SD%20Tutorial.pdf http://www.win.tue.nl/~johanl/educ/IoT-Course/mDNS-SD%20Tutorial.pdf
- http://agnat.github.io/node_mdns/user_guide.html http://agnat.github.io/node_mdns/user_guide.html
- https://opensource.apple.com/source/mDNSResponder/mDNSResponder-320.10/mDNSPosix/ReadMe.txt https://opensource.apple.com/source/mDNSResponder/mDNSResponder-320.10/mDNSPosix/ReadMe.txt
However, the most accurate information that we found is the following: http://irq5.io/2011/04/10/publishing-services-over-mdns-in-c/ http://irq5.io/2011/04/10/publishing-services-over-mdns-in-c/ . It's a description posted by someone that explains how to publishing Services over mDNS in C and provide an implementation that he did.
The information above is not for Edison itself, but more generic for Linux/Yocto, so we would suggest you to read these sources (and probably other ones as well) to accomplish what you want to do.
Let us know if that information helps.
Thanks - there is some great information there!
However the link to publishing using C code shows someone who created their own mDNS Responder - the Edison image I am using already includes mdnsd.
What I found with my own research was that I simply need to include and then link against libdns-sd.lib and make simple calls to DNSServiceRegister - that way I can let the existing daemon do all the hardwork.
This approach uses industry proven code that is already running on my device.
I'm glad to know that you found that information helpful.
I have not advertised a service using mdnsd, however I'm happy to know that you are in the correct way, also you can share your results in the community, and it will help other users.