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

    LoPy socket.getaddrinfo strange return

    Scheduled Pinned Locked Moved LoPy
    3 Posts 3 Posters 1.0k 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.
    • P Offline
      PCA
      last edited by

      Hi,
      on LoPY 0.9.5.b1 socket.getaddrinfo() not alwaysreturn the same result.
      Sometimes 0.0.0.0, sometime 10.0.0.0, sometime the good value.

      os.uname()
      (sysname='LoPy', nodename='LoPy', release='0.9.5.b1', version='v1.8.6-13-ge1a0670 on 2016-11-18', machine='LoPy with ESP32')

      import socket
      socket.getaddrinfo('forum.pycom.io', 80)
      [(2, 1, 0, '', ('0.0.0.0', 80))]
      socket.getaddrinfo('forum.pycom.io', 80)
      [(2, 1, 0, '', ('10.0.0.0', 80))]
      socket.getaddrinfo('forum.pycom.io', 80)
      [(2, 1, 0, '', ('56.137.253.63', 80))]

      Any idea ?
      Thanks
      Pascal

      1 Reply Last reply Reply Quote 0
      • Y Offline
        yahia
        last edited by

        I had the same problem. I was trying to connect to an ntp server and it always returns a random ip. If you however use the ip directly instead of the domain name it works and stays consistent. Try 216.58.214.164 (This is google.com) and you will see what I mean. I will report a bug.

        bmarkusB 1 Reply Last reply Reply Quote 0
        • bmarkusB Offline
          bmarkus @yahia
          last edited by bmarkus

          @yahia said in LoPy socket.getaddrinfo strange return:

          I had the same problem. I was trying to connect to an ntp server and it always returns a random ip. If you however use the ip directly instead of the domain name it works and stays consistent. Try 216.58.214.164 (This is google.com) and you will see what I mean. I will report a bug.

          It is a different case. Probably you have used a domain name for a pool of ntp servers instead of a server. In such case you get different server address from the pool.

          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