mDNS on Photon?

Hey everyone,
I’m trying to get mDNS or any other service (Netbios?) set up on my Photon so that I can connect to it without finding and entering its actual IP address. Right now I’ve got an HTTP server running on it and I found this post which references a function called mdnsAdvertiser. Seemed perfect to me but I’m not sure what to include in order to access that function, or if that is even possible. I checked out the git repo for the Photon and found mdnsAdvertiser declared in socket.h but am unable to include that by default in my project.

Give Spark Core a Host Name?

Anyone have any ideas?

I have had mdns advertiser working on an esp8266.

The way it seems to work is that it accepts DNS datagrams sent over the internet and responds (normally it’s name is xxx.local) - so on the other machine you would nslookup xxx.local and get an address back!

Essentially you do some setup code and then periodically you call a function that responds to any queued requests.

SO you would have to;

Find the library
Incorporate the library into your sketch.
In setup, call the library to set things up.
In loop, periodically call the function to respond to any DNS requests.

I am at work and don’t have my code base available - but will have a look tonite.


1 Like

Hi @Steven4755

There are two mDNS libraries for Photon already. Start with this thread: