Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    what server does urequests use for dns lookups?

    Scheduled Pinned Locked Moved GPy
    6 Posts 3 Posters 134 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kjm
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by Gijs

        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.

        K 1 Reply Last reply Reply Quote 0
        • K Offline
          kjm @Gijs
          last edited by

          @Gijs said in what server does urequests use for dns lookups?:

          socket.dnsserver()

          dns reply in 7.135s ('23.48.250.48', 80) from ('10.4.58.204', '10.5.136.242')
          

          Kinda slow some days here in Australia, I wonder what country they're in?

          J 1 Reply Last reply Reply Quote 0
          • G Offline
            Gijs
            last edited by

            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. socket.dnsserver('8.8.8.8','0.0.0.0')
            Gijs

            1 Reply Last reply Reply Quote 0
            • J Offline
              jcaron @kjm
              last edited by

              @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.

              K 1 Reply Last reply Reply Quote 0
              • K Offline
                kjm @jcaron
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better đź’—

                Register Login
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom