esp-tls: couldn't get hostname for :example.com: getaddrinfo() returns 202, addrinfo=0x0
Posted: 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
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