Skip to content
A library for resolving mDNS (Bonjour) host names
Branch: master
Clone or download
madpilot Merge pull request #8 from lobradov/patch-1
Bump the library version
Latest commit 3fbc89d Apr 6, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
fixtures Building out parse answer. Need to run some tests Nov 1, 2016
mocks Quick returns if the domain is .local, adding a test for checking tim… Nov 20, 2016
src Quick returns if the domain is .local, adding a test for checking tim… Nov 20, 2016
test Quick returns if the domain is .local, adding a test for checking tim… Nov 20, 2016
LICENSE.txt Adding a readme, an example, limited hardware specs to ESP8266 at the… Nov 20, 2016
Makefile Setting an env variable so we can supply the g++ path, because travis Nov 17, 2016
library.json Bump the library version Apr 5, 2018

mDNS Resolver Build Status

An Arduino library that resolves mDNS (bonjour) names. It doesn't do any discovery, it just resolves names.


  • Hardware: ESP8266. I don't believe the stock Arduino UDP library supports multicast (Please correct me if I'm wrong), so only the ESP8266 is supported at the moment
  • Software: Tested against avahi and avahi-alias which adds CNAMEs. Post a bug report if it doesn't work with a server that you are using.


My home automation projects don't need discovery - I just wanted to be able to enter the name of my MQTT server when configuring my devices. There are other libraries out there that do discovery of services, but they didn't do name resolution easily - And they introduced more code than I needed.


Clone this code in to your Arduino directory.

cd ~/Arduino
git clone

Restart your IDE. You can now include

#include <mDNSResolver.h>

in your sketch.


IPAddress ip ="test.local");

Returns INADDR_NONE if the name can't be found.

See the examples folder for the full setup details

Advanced Customisation

You can change a few settings by defining some constants before including the mDNSResolver header file, but only if you really know what you are doing

#define MDNS_RETRY    1000      # Number of milliseconds between rebroadcasting a name query
#define MDNS_ATTEMPTS 5         # Number of times to try a resolving before giving up
#define UDP_TIMEOUT   255       # Amount of time (in milliseconds) before giving up on the UDP packet
#define MDNS_TLD      ".local"  # Top-level domain to search for. This can technically be anything, but pretty much everyone says leave it as .local

#include <mDNSResolver.h>


The library has a suite of specs, which you can run on any machine that supports g++ (requires c++11 support).

The specs are written using Catch, written in BDD style.

make test


Issues and bugs can be raised on the Issue tracker on GitHub

For code and documentation fixes, clone the code, make the fix, write and run the tests, and submit a pull request.

Feature branches with lots of small commits (especially titled "oops", "fix typo", "forgot to add file", etc.) should be squashed before opening a pull request. At the same time, please refrain from putting multiple unrelated changes into a single pull request.




Much inspiration, and some parts of the code have been taken (or modified from)

You can’t perform that action at this time.