https://en.wikipedia.org/wiki/Multicast_DNS
Sming provides the :cpp:class:`mDNS::Responder` class to allow applications to advertise themselves on the local network.
To use:
Add
COMPONENT_DEPENDS += MDNS
to your application componenent.mk file.Add these lines to your application:
#include <Mdns/Responder.h> static mDNS::Responder responder; // Call when IP address has been obtained void startmDNS() { responder.begin(F("myhostname"); }
This will advertise the device as myhostname.local
.
To provide a custom service, implement a :cpp:class:`mDNS::Service` class and call :cpp:func:`mDNS::Responder::addService`.
See the :sample:`UdpServer_mDNS` sample application.
This library also provides support for device discovery using a separate set of classes, based on the :cpp:class:`mDNS::Server`. See :sample:`Basic_Mdns` for an example.
For linux, you can use avahi to perform mDNS queries and confirm output is as expected:
sudo apt install avahi
avahi-browse --all -r
- Multicast DNS RFC6762 https://tools.ietf.org/html/rfc6762
- Zero-configuration networking (DNS-SD) https://en.wikipedia.org/wiki/Zero-configuration_networking
- DNS-Based Service Discovery https://tools.ietf.org/html/rfc6763
- DNS record types https://en.wikipedia.org/wiki/List_of_DNS_record_types
- Domain Names: Implementation and Specification https://tools.ietf.org/html/rfc1035
.. doxygennamespace:: mDNS