Trouble starting mDNS

rtborg
Posts: 67
Joined: Wed Oct 23, 2019 6:15 am

Trouble starting mDNS

Postby rtborg » Sat Jul 09, 2022 12:45 pm

The official example works fine, however I am unable to add mDNS to an existing project. Here's my initialization function:

Code: Select all

static void mdns_initialize(const char *hostname, const char *instance)
{
    ESP_ERROR_CHECK( mdns_init() );
    ESP_ERROR_CHECK( mdns_hostname_set(hostname) );
    ESP_ERROR_CHECK( mdns_instance_name_set(instance) );

    mdns_txt_item_t serviceTxtData[3] = {
        {"board", "esp32"},
        {"u", "user"},
        {"p", "password"}
    };

    ESP_ERROR_CHECK( mdns_service_add("gateway_server", "_http", "_tcp", 80, serviceTxtData, 3) );
}
It is called immediately after `esp_netif_init` and `esp_event_loop_create_delault`. No error messages in the log, below are the only two messages that refer to mDNS:

Code: Select all

D (10574) w5500.mac: working in full duplex
D (10574) w5500.mac: link is up
D (10574) event: running post ETH_EVENT:2 with handler 0x400f1a04 and context 0x3ffc322c on loop 0x3ffafa08
0x400f1a04: event_handler at /home/machine/esp/esp-idf/components/mdns/mdns.c:4699
It does not work with both wired and wireless connection. What could be the possible reason? I also have a http server on port 80 if that's relevant.

EDIT: The service works for WiFi, but not for wired connection using W5500 chip.

rtborg
Posts: 67
Joined: Wed Oct 23, 2019 6:15 am

Re: Trouble starting mDNS

Postby rtborg » Thu Jul 21, 2022 7:33 am

Anyone facing the same problem?

Who is online

Users browsing this forum: ESP_Sprite and 56 guests