DNS lookup failed err=202 res=0x0

pablogurjao
Posts: 7
Joined: Thu Jun 08, 2017 6:34 pm

DNS lookup failed err=202 res=0x0

Postby pablogurjao » Thu Jun 08, 2017 7:34 pm

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?

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » 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?

pablogurjao
Posts: 7
Joined: Thu Jun 08, 2017 6:34 pm

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

Postby pablogurjao » Fri Jun 09, 2017 2:26 pm

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!

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

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

Postby Ritesh » Sat Apr 13, 2019 4:33 am

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.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: No registered users and 120 guests