mDNS: Multicast Domain Name System

https://en.wikipedia.org/wiki/Multicast_DNS

Sming provides the mDNS::Responder class to allow applications to advertise themselves on the local network.

Issuing discovery requests is not currently supported.

Using

  1. Add COMPONENT_DEPENDS += mdns to your application componenent.mk file.

  2. 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 mDNS::Service class and call mDNS::Responder::addService().

See the UDP Server mDNS sample application.

Testing

For linux, you can use avahi to perform mDNS queries and confirm output is as expected:

sudo apt install avahi
avahi-browse --all -r

API Documentation

namespace mDNS

References

Used by

Environment Variables