Skip to content

Latest commit

 

History

History
71 lines (44 loc) · 1.71 KB

README.rst

File metadata and controls

71 lines (44 loc) · 1.71 KB

mDNS: Multicast Domain Name System

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

Responder

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

To use:

  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 :cpp:class:`mDNS::Service` class and call :cpp:func:`mDNS::Responder::addService`.

See the :sample:`UdpServer_mDNS` sample application.

Discovery

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.

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

References

API Documentation

.. doxygennamespace:: mDNS