MDNS and DNS Service Discovery library


Is it possible to subscribe for services or it can still only create services? As I cannot resolve the host IP, I was planning on creating a service on my host which will transmit it’s IP address and the photon could subscribe to that service and get the host IP


Hi @moz,

Locating services (DNS-SD) uses the same resolve functionality as resolving hostnames so is not supported right now.



So that would mean there is currently no way to resolve the host IP from a particle photon using the mDNS. Is there any other way to accomplish something similar in a dynamic network system? The ultimate purpose of introducing the mDNS was to solve this issue but it is sad to see it is not available on the particle yet.


Can you point me to exactly what all will be needed to add this functionality as I want to do it. As far as I understand, it would require to form a QTYPE A packet and transmit it on the group. After which it waits for a response. It takes in the response, parse them and take out the IP address of the sender/host.
Is there any hints or tips you would want to give? What are the specific functions in your library that will help me in this?


Hi @moz,

Correct, you can re-use some of the existing classes to build a query packet, send it out over UDP and then wait for responses. You’d need to consider how long you want to block waiting for responses or whether you can successfully poll for a response every so often.



Hey. I was testing your example function and after some time the core-1.local/ seems to stop working. I am guessing it is disconnecting from the mDNS group. Any ideas on why this is happening?


Hi @moz,

I’ve seen issues with this in the past, but not for a while. What hardware are you using and which version of firmware? Have you modified the sample code at all?

I’ll try to replicate if you can give me the above details.




I was using a particle photon with base OS as 1.2.0 and the code was target at 1.1.0-rc.2
I was using your base code without any modifications


Hi @moz,

I’ve just tried to replicate your issue and I’m not having any luck. I’m using the web ide so could only target 1.2.1, but my Photon has been up and responding to continual connections to it’s http service for over 40 minutes. I’ve seen one or two closed connections and a pause of a few seconds here and there, but it always continues shortly afterwards.

When you say it stops working what exactly is happening? Is it failing to respond to MDNS requests or failing to respond to HTTP (on port 80 or 8080?)



So what was happening was I was not ale to access the core-1.local/ from my browser after some time.