Http.request timeout maybe due to no ipv6 network support

The http requests are always successful in a WIFI network, but some times failed when use 4G network. After change the APN protocol from IPv4/IPv6 to IPv4, then everything works well.

Access Point Names

The host in some requests might be resolved to a IPv6 address which is not processed by the 4G network due to lack of vendor resource in China. Is it possible that the http.request API can handle this issue automatically?

Hm, do you know if you get both an IPv6 and a IPv4 address from the URL you are requesting? As in, could you test it outside of Defold somehow? We need to support both formats, and our DNS lookup will pick the first valid address that is returned from the getaddrinfo function so it depends on the position in the list. We don’t test all addresses for connection (which I guess we should, but that’s a different story), so we just assumes that the first address in the list is OK.

I’m working on an ANR issue now related to DNS lookups that coincidentally might solve your problem, but it depends on if you get both IPv4 and IPv6 addresses from the same host…

3 Likes

I did a simple test based on the demo project.
The socket.dns.getaddrinfo(“thirdwx.qlogo.cn”) does return a table where the first valid adress is an ipv6 address.


That should be the cause for the http.request timeout using 4G network.

Meanwhile, the same test using wifi does not return any ipv6 address.

1 Like

It’s already proved that both IPv4 and IPv6 addresses are returned for the same host. Is there a plan or ticket to solve it?

As a workarround, i will resolve the host by myself and replace the origin host with the first IPv4 address in the url.

1 Like

Yes, I’m hopeful that the new DNS resolver will adress this issue aswell. Might make it in to next release, or the one after.

4 Likes

hey, i am also facing the same issue!! I think Router login guide might be helpful in this case.

I did a simple replace when the first valid address is v6 as a workarround.

workarround.txt (635 Bytes)

I believe we have a permanent fix on its way on Tuesday.

3 Likes