From a command prompt I monitor for mDNS adverts using:
Code: Select all
dns-sd -B _services._dns-sd._udp
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) );
}