-->
Page 1 of 3

get IP addresses of all MQTT servers on network with mDNS.

PostPosted: Sun Aug 02, 2015 7:27 am
by dunk
while searching for the solution i found examples that allow the ESP8266 to become an mDNS Responder eg: https://github.com/esp8266/Arduino/blob/esp8266/hardware/esp8266com/esp8266/libraries/ESP8266mDNS/examples/mDNS_Web_Server/mDNS_Web_Server.ino
but nowhere could i find code that allowed me to Discover mDNS Services on the network.

so i wrote this little library over the last week or two:
https://github.com/mrdunk/esp8266_mdns
it's my first time playing with the Arduino environment so please forgive any deviations from accepted Arduino coding style.

there are examples for the following included:
1. https://github.com/mrdunk/esp8266_mdns/ ... simple.ino displays *all* mDNS data received by the ESP8266.
2. https://github.com/mrdunk/esp8266_mdns/ ... s_test.ino sends an mDNS Question requesting the _mqtt._tcp.local service and returns the ipv4 network address of all hosts providing this service.

the library could be used as the starting point for any project that needs access to raw mDNS data.

Re: get IP addresses of all MQTT servers on network with mDN

PostPosted: Sat Feb 06, 2016 5:57 am
by dunk
after trying to find this post again via search engine i discovered i'm missing some pertinent search terms in the text...
this post is relevant to anyone who is trying to create an mDNS client or Bonjour client.

my use case involves running an MQTT (mosquitto) broker on another embedded machine and advertising it's presence via mDNS (Avahi) to achieve my goal of zero configuration of the esp8266.
the Arduino code posted above will allow the esp8266 to discover the Brokers location via mDNS.

apologies for the blatant keyword stuffing in the above paragraph.

Re: get IP addresses of all MQTT servers on network with mDN

PostPosted: Sun Feb 07, 2016 6:58 am
by PhilHornby
I'm new to ESP8266, so I'm working my way through all the examples I can find.

I can't get this one to compile - I'm missing "mdns.h". I tried using the supplied "ESP8266mDNS.h" instead, but that doesn't help.

Re: get IP addresses of all MQTT servers on network with mDN

PostPosted: Fri Feb 19, 2016 2:00 am
by Arunk3001
I'm trying to use this library to discover and connect to an MQTT server, but I'm having difficulty understanding how to get an IP address out of a request. The server is responding to server.local when queried from browser, but I can't connect "server.local" to an IP address in the ESP. When I run the simple example I can see the server responding to mDNS queries with an IP, but I can't seem to find my way beyond that. Any advice as far as where to look to get started?