socket.getaddrinfo returns error
-
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.
Anyone can help me
-
@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
-
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?
-
@jcaron ı am from Turkey and using turkcell nb-ıot sim card. Is it a problem?
Thanks for reply!
-
@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