LoPy socket.getaddrinfo strange return



  • 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



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



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


Log in to reply
 

Pycom on Twitter