Page 1 of 1

DNS lookup failed err=202 res=0x0

Posted: Thu Jun 08, 2017 7:34 pm
by pablogurjao
good afternoon,
I'm working with esp 32 and I'm try to reproduce the http_request _example form esp-idf and I'm with some trouble in this peace of code:

Code: Select all

#define WEB_SERVER "example.com"
.
.
.
struct addrinfo *res;	
struct addrinfo hints = {
          .ai_family = AF_INET,
	   .ai_socktype = SOCK_STREAM,
};	
int result = getaddrinfo(WEB_SERVER , "80", &hints, &res);
if((result != 0) || (res == NULL))
{
	ESP_LOGE(log_string, "DNS lookup failed err=%d res=%p", result, res);
}
The condition "if" is called and this error apear:

DNS lookup failed err=202 res=0x0

Someone knows how to solve this problem?

Re: DNS lookup failed err=202 res=0x0

Posted: Fri Jun 09, 2017 7:23 am
by ESP_Sprite
202 is EAI_FAIL, which is a general permanent failure. Are you sure WiFi is up and running? If so, can you maybe do a packet dump using Wireshark or something?

Re: DNS lookup failed err=202 res=0x0

Posted: Fri Jun 09, 2017 2:26 pm
by pablogurjao
My function request was been called before the end of my function wifi_connect, when I put a function to wait the end of wifi_connect, it worked.
Thanks!

Re: DNS lookup failed err=202 res=0x0

Posted: Sat Apr 13, 2019 4:33 am
by Ritesh
ESP_Sprite wrote:
Fri Jun 09, 2017 7:23 am
202 is EAI_FAIL, which is a general permanent failure. Are you sure WiFi is up and running? If so, can you maybe do a packet dump using Wireshark or something?
Hi,

We are working on ESP32 IDF 3.1 Stable release and we are using MQTT protocol as per requirement with external network access.

We have created one hotspot into mobile and doing stress testing to connect and disconnect with mobile hotspot and MQTT server which we have prepared as per requirement.

So, sometimes, we have faced issue of Getaddresinfo failed with error as 202 and also tried to capture wifi traces in which we have observed that DNS query gets failed to resolve.

We have also checked with MQTT server and also dumped request but didn't find much details.

So, Would you please help me like what can be possible reason for this issue and how it can be resolved?

Let me know if you need any more details regarding that.