mDNS advert

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

mDNS advert

Postby PeterR » Tue Aug 27, 2019 4:14 pm

I want to create a number of mDNS adverts.
From a command prompt I monitor for mDNS adverts using:

Code: Select all

dns-sd -B _services._dns-sd._udp
I have copied code the mDNS example codefrom esp\esp-idf\examples\protocols\mdns\main (see bottom).
I wait until I have an Ethernet IP address and then initialise.
I see some broadcasts to 255.255.255.255 from my ESP32's IP address (which is my uDP logger) but no other traffic and dns-sd does not detect the service.

Am I using the correct setup and monitoring commands?

Code: Select all

extern "C" void mdns_initialise()
{
    char* hostname = "petes";
    //initialize mDNS
    ESP_ERROR_CHECK( mdns_init() );
    //set mDNS hostname (required if you want to advertise services)
    ESP_ERROR_CHECK( mdns_hostname_set(hostname) );
    ESP_LOGI(TAG, "mdns hostname set to: [%s]", hostname);
    //set default mDNS instance name
    ESP_ERROR_CHECK( mdns_instance_name_set(EXAMPLE_MDNS_INSTANCE) );
    
    //structure with TXT records
    mdns_txt_item_t serviceTxtData[3] = {
        {"board","esp32"},
        {"u","user"},
        {"p","password"}
    };

    ESP_ERROR_CHECK( mdns_service_add("ESP32-WebServer", "_http", "_tcp", 80, serviceTxtData, 3) );    
}
& I also believe that IDF CAN should be fixed.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: mDNS advert

Postby PeterR » Wed Aug 28, 2019 11:18 am

Failing as going through a gateway (doh!).
Switched to a a switch and can see services now.
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 131 guests