what server does urequests use for dns lookups?
I'm looking at the urequests library but I can't tell who ai=socket.getaddrinfo goes to for the ip address of the host. Is that burried somewhere else in frozen byte code?
@jcaron Yeah it was a 4G issue, Telstra lte was really slow on dns lookups for about 24hrs but the nbn wifi was fine. So looks like the details returned from socket.dnsserver() are the servers provided by the network you're on. I'll try Gijs idea of forcing it to use a particular server. God knows how long I'll have to wait for the great slowdown to happen again so I can see if it's dns server related or not. The subsequent upload to my server wasn't slow just the dns lookups.
I get the feeling I'm in over my head with this stuff. The rtc syning prior to the dns lookup was slower than normal too so some sort of weird network delay that impacted time & dns servers but not my server.
@kjm DNS servers are usually provided by the network you’re connected to (via DHCP on WiFi or Ethernet for instance). The 10/8 addresses point to local network servers.
What network are you connected to?
Note that 7 seconds is definitely not just round trip latency. Even if it were on the opposite side of the planet it would be an order of magnitude lower. What address are you trying to resolve? It could be a misconfiguration of the servers for that address, or it could be network issue somewhere. DNS lookups are recursive so if can be quite complex to debug. Try dns.squish.net to get an idea.
Is that the output of calling
socket.dnsserver()? As I get the following:
>>> import socket >>> wlan.isconnected() True >>> socket.dnsserver() ('10.0.0.1', '0.0.0.0')
You could set your own dnsserver, eg.
dns reply in 7.135s ('22.214.171.124', 80) from ('10.4.58.204', '10.5.136.242')
Kinda slow some days here in Australia, I wonder what country they're in?
You can check that using
socket.dnsserver()I believe. It will output the two (main and backup) DNS servers registered. You can also set them using parameters.