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

    socket.getaddrinfo returns error

    Scheduled Pinned Locked Moved FiPy
    5 Posts 3 Posters 126 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.
    • A Offline
      AlganEren
      last edited by

      from network import LTE
      import time
      import usocket
      
      lte = LTE()
      lte.init()
      #some carriers have special requirements, check print(lte.send_at_cmd("AT+SQNCTM=?")) to see if your carrier is listed.
      #when using verizon, use 
      #lte.init(carrier=verizon)
      #when usint AT&T use, 
      #lte.init(carrier=at&t)
      
      #some carriers do not require an APN
      #also, check the band settings with your carrier
      lte.attach(band=20, apn="nbiot") 
      print("attaching..",end='')
      while not lte.isattached():
          time.sleep(0.25)
      
          print('.',end='')
          print(lte.send_at_cmd('AT!="fsm"')) 
          print(lte.send_at_cmd('AT+CSQ'))         # get the System FSM
      print("attached!")
      
      lte.connect()
      print("connecting [##",end='')
      while not lte.isconnected():
          time.sleep(0.25)
          print('#',end='')
          #print(lte.send_at_cmd('AT!="showphy"'))
          print(lte.send_at_cmd('AT!="fsm"'))
      print("] connected!")
      print(usocket.getaddrinfo('google.com', 80))  
      lte.deinit()
      

      I can connect to lte. but then this print (usocket.getaddrinfo ('google.com', 80)) fails on the line. The error is as follows.

      WhatsApp Image 2020-08-17 at 14.14.41.jpeg

      Anyone can help me

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

        @AlganEren What SIM are you using? If you are using a Pycom-provided Vodafone SIM, see https://forum.pycom.io/topic/6064/oserror-errno-202-eai_fail-when-connected-to-nb-iot-vodafone-germany/2

        1 Reply Last reply Reply Quote 1
        • A Offline
          AlganEren
          last edited by

          @jcaron ı am from Turkey and using turkcell nb-ıot sim card. Is it a problem?
          Thanks for reply!

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

            The function should work as expected and return the address info.. EAI (Error Address Info) fail usually means the DNS could not be resolved. Im not sure of the internet limitations provided by your carrier, but have you tried other addresses?

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

              @AlganEren Note that some providers do not send DNS server info during the connection process (so you have to configure them manually), and that older versions of the firmware had issues with DNS over NB-IoT, apparently.

              You may want to check this thread:
              https://forum.pycom.io/topic/4247/dns-now-working-a-list-documentation-of-all-lte-nb1-nb-iot-lte-m-lte-catm1-operators-around-the-world

              1 Reply Last reply Reply Quote 1

              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