esp-tls: couldn't get hostname for :example.com: getaddrinfo() returns 202, addrinfo=0x0

JonasL
Posts: 13
Joined: Mon Nov 28, 2022 4:37 pm

esp-tls: couldn't get hostname for :example.com: getaddrinfo() returns 202, addrinfo=0x0

Postby JonasL » Wed Mar 29, 2023 11:09 am

Hello everyone,

I have stumbled upon a problem in the last step of my esp32 project with this error. This error occurs when I am calling esp_http_client_perform(client) API. ESP-IDF monitor provides the following message:
E (36765) esp-tls: couldn't get hostname for :example.com: getaddrinfo() returns 202, addrinfo=0x0
E (36765) esp-tls: Failed to open new connection
E (36775) transport_base: Failed to open a new connection
E (36775) HTTP_CLIENT: Connection failed, sock < 0
E (36785) HTTP event handler: HTTP_EVENT_ERROR
E (36785) HTTP client: HTTP POST request failed: ESP_ERR_HTTP_CONNECT
What I have noticed is that this error only occurs when esp32 connects to mobile wifi hotspot. When using home wifi connection http sequence goes without any errors. I have tried disabling ESP-TLS component in menuconfig, allowing potentially insecure options and skipping server verification. Similar error was discussed in these threads, not sure if error culprit is the same: https://esp32.com/viewtopic.php?t=26498
https://github.com/espressif/esp-idf/issues/6940

rahulbari
Posts: 10
Joined: Mon Feb 26, 2024 6:55 am

Re: esp-tls: couldn't get hostname for :example.com: getaddrinfo() returns 202, addrinfo=0x0

Postby rahulbari » Tue Jul 02, 2024 2:42 pm

I am facing the same issue, could you get any solution so that it would be helpful for us.

Thanks in advance
Rahul B.

esp32dev1
Posts: 1
Joined: Fri Jul 12, 2024 6:38 am

Re: esp-tls: couldn't get hostname for :example.com: getaddrinfo() returns 202, addrinfo=0x0

Postby esp32dev1 » Fri Jul 12, 2024 6:39 am

same issue

toljatyr
Posts: 13
Joined: Mon Mar 07, 2022 10:39 am

Re: esp-tls: couldn't get hostname for :example.com: getaddrinfo() returns 202, addrinfo=0x0

Postby toljatyr » Thu Nov 14, 2024 11:50 am

I am also facing the same. Error occurred and lasts for some time, but if I restart the MCU it works OK

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: esp-tls: couldn't get hostname for :example.com: getaddrinfo() returns 202, addrinfo=0x0

Postby chegewara » Wed Nov 20, 2024 6:48 am

There is not enough data to help with the issue.
Is the connection success before you call "getaddrinfo"? And by success, i mean you get IP address from DNS or set static IP after connecting to router.

Who is online

Users browsing this forum: No registered users and 79 guests