mDNS not found on ESP IDF 5.1.2

tankist
Posts: 14
Joined: Tue Feb 08, 2022 7:22 am

mDNS not found on ESP IDF 5.1.2

Postby tankist » Fri Jan 05, 2024 10:36 am

I make a WiFi device on ESP32-S3, it should works on STA mode and connects to another access point (AP). AP has DHCP server so when my device is connected to AP is has random IP address. There is an application on AP which should communicate with TCP server on my device, it doesn't know current IP address of my device. So I decided to use DNS server on ESP side to make connection easy: AP application will be connected to TCP server on ESP by host name, not by IP address.

I wonder if it possible to start DNS server on ESP in STA mode. I found out some information about mDNS server. I tried to use the example:

Code: Select all

	    ESP_ERROR_CHECK(mdns_init());
	    ESP_ERROR_CHECK(mdns_hostname_set("name"));
but is was unsuccessful: functions mdns_init() and mdns_hostname_set() not found.
I tried to search in ESP-IDF directory to find the right location of this function, but... I didn't find them at all! There are no files inside ESP-IDF directory which contains these functions. They are called in examples only.

So there is a question: where can I find these finctions?

I use official Espressif-IDE 2.11.1 with ESP-IDF 5.1.2, windows platform.

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: mDNS not found on ESP IDF 5.1.2

Postby MicroController » Fri Jan 05, 2024 2:02 pm

https://docs.espressif.com/projects/esp ... /mdns.html:
The ESP-IDF component mDNS has been moved from ESP-IDF since version v5.0 to a separate repository.
...
To add mDNS component in your project, please run idf.py add-dependency espressif/mdns.

tankist
Posts: 14
Joined: Tue Feb 08, 2022 7:22 am

Re: mDNS not found on ESP IDF 5.1.2

Postby tankist » Mon Jan 08, 2024 5:36 am

Thank you for the suggestion, but the only thing this command does is just update the content of idf_component.yml file. The requested component still doesn't appear in ESP-IDF directory. Does this require any additional steps?

Pixellord
Posts: 13
Joined: Wed Feb 15, 2023 8:58 am

Re: mDNS not found on ESP IDF 5.1.2

Postby Pixellord » Mon Jan 08, 2024 9:50 am

You can find an example of mDNS in RESTful server:
https://github.com/espressif/esp-idf/bl ... est_main.c

tankist
Posts: 14
Joined: Tue Feb 08, 2022 7:22 am

Re: mDNS not found on ESP IDF 5.1.2

Postby tankist » Tue Jan 09, 2024 5:36 am

Pixellord wrote:
Mon Jan 08, 2024 9:50 am
You can find an example of mDNS in RESTful server:
https://github.com/espressif/esp-idf/bl ... est_main.c
The example you provide is "how to use", but the question is "where to get". I still have no idea how to make DNS server on current version of ESP IDF.

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: mDNS not found on ESP IDF 5.1.2

Postby MicroController » Tue Jan 09, 2024 11:15 am

tankist wrote:
Tue Jan 09, 2024 5:36 am
The example you provide is "how to use", but the question is "where to get". I still have no idea how to make DNS server on current version of ESP IDF.
Have you tried building the example?

(See also: https://docs.espressif.com/projects/esp ... %20project)

User avatar
mbratch
Posts: 303
Joined: Fri Jun 11, 2021 1:51 pm

Re: mDNS not found on ESP IDF 5.1.2

Postby mbratch » Tue Jan 09, 2024 11:07 pm

tankist wrote:
Mon Jan 08, 2024 5:36 am
Thank you for the suggestion, but the only thing this command does is just update the content of idf_component.yml file. The requested component still doesn't appear in ESP-IDF directory. Does this require any additional steps?
Did you try doing the build after creating the `idf_component.yml` file in the location prescribed?
The build tools fetch it automatically when it's specified.

See IDF Component Manager:
The IDF Component Manager is a tool that downloads dependencies for any ESP-IDF CMake project. The download happens automatically during a run of CMake. It can source components either from the component registry or from a Git repository.

tankist
Posts: 14
Joined: Tue Feb 08, 2022 7:22 am

Re: mDNS not found on ESP IDF 5.1.2

Postby tankist » Wed Jan 10, 2024 8:46 am

MicroController wrote:
Tue Jan 09, 2024 11:15 am
tankist wrote:
Tue Jan 09, 2024 5:36 am
The example you provide is "how to use", but the question is "where to get". I still have no idea how to make DNS server on current version of ESP IDF.
Have you tried building the example?

(See also: https://docs.espressif.com/projects/esp ... %20project)
I haven't build any example before so I tried to do this as suggested. It was helpful, because I found out that mDNS componet downloads automatically into a project folder, not into ESP-IDF as I expected. I tried to repeat these steps to add a component to my project and I got a tutorial how to do this:
1) Open shell (in my case Windows Power Shell) and navigate into a project directory
2) Execute idf.py add-dependency espressif/mdns command
3) Execute idf.py reconfigure command (no one tell me I should do that)
4) Rebuild a project inside ESP IDE

After third step I've got a directory with a new component inside.

I guess it's kind of ridiculous to do so many steps in shell. I wonder if it possible to do the same via ESP IDE graphical interface.

tankist
Posts: 14
Joined: Tue Feb 08, 2022 7:22 am

Re: mDNS not found on ESP IDF 5.1.2

Postby tankist » Wed Jan 10, 2024 8:48 am

mbratch wrote:
Tue Jan 09, 2024 11:07 pm
tankist wrote:
Mon Jan 08, 2024 5:36 am
Thank you for the suggestion, but the only thing this command does is just update the content of idf_component.yml file. The requested component still doesn't appear in ESP-IDF directory. Does this require any additional steps?
Did you try doing the build after creating the `idf_component.yml` file in the location prescribed?
The build tools fetch it automatically when it's specified.

See IDF Component Manager:
The IDF Component Manager is a tool that downloads dependencies for any ESP-IDF CMake project. The download happens automatically during a run of CMake. It can source components either from the component registry or from a Git repository.
The build process DOES NOT help download a component. This only happens after idf.py reconfigure command.

User avatar
mbratch
Posts: 303
Joined: Fri Jun 11, 2021 1:51 pm

Re: mDNS not found on ESP IDF 5.1.2

Postby mbratch » Wed Jan 10, 2024 4:53 pm

tankist wrote:
Wed Jan 10, 2024 8:48 am
The build process DOES NOT help download a component. This only happens after idf.py reconfigure command.
Yes, I think that is described in the details of the link I provided. The reconfiguration is needed for the process to work.

It would indeed be nice to have access to all these things from the IDE. I use Eclipse and, only fairly recently, the "idf.py fullclean" was available from within the IDE as a right-click command on the project.

Who is online

Users browsing this forum: Baidu [Spider] and 92 guests