Error while connecting pybytes with LTE



  • Hello, I've been able to send signals to pyBytes using wifi connection. When I try it with LTE and NB-IOT even when the LTE is connected I have the following messages

    LTE is_connected()
    LTE connection established
    connect_lte with start_mqtt is now removed please call communication_protocol or start_mqtt directly
    MQTT Protocol
    Socket create error: [Errno 202] EAI_FAIL
    This is PybytesProtocol.start_MQTT
    Socket send error [Errno 128] ENOTCONN
    Socket create error: [Errno 202] EAI_FAIL
    Regards



  • @Gijs Hi. The output of dnsserver after pybytes.start is ('172.31.16.100', '172.31.32.100'), while the output of AT+CGCONTRDP? is always ERROR. I tried to move the AT command in different parts of the code but the result was always ERROR. When the device fails I cannot retrieve any information, so I don't know what the dnsserver output is. I'm using your Vodafone SIM in Italy. Thank you



  • I think your issue is different.
    If you're able to send signals to pybytes a first, but get an eai_fail error later, it might be related to your network connection. It should not reset the DNS servers, as is the issue above (the LTE network does not provide a DNS server from the start there). Just to be sure, could you let me know what socket.dnsserver() gives you (before it fails and after it fails), and what lte.send_at_cmd('AT+CGCONTRDP?') returns ?



  • Hi, I'm facing the same issue as @Osquillar. I use NB-IoT on my Fipy. The device sends messages correctly when I power it on, then all of a sudden it starts to have these problems: 202 eai_fail and 128 enotconn. After the first time it encounters this problem, it never recovers. This problem is triggered when calling the function pybytes.start or pybytes.connect.
    So the problem is on the DNS server? Can we use 8.8.8.8 or do we need to use another one?
    Thank you @Gijs for your constant help.



  • It indeed seems to be related to the DNS server not being set correctly by the Vodafone service. You can manually set the DNS server by using:

    import socket;
    socket.dnsserver() #this should return empty
    socket.dnsserver('primary','secondary')
    

    My colleague @Xykon can tell you more about the DNS server IP address. It has to be specific to the pycom servers (so setting 8.8.8.8 as the dns server should not work)

    Best,
    Gijs



  • @Gijs Hi, the modem firmware is LR6.0.0.0-41019 so I think it is correct.
    I still belive the problem is within vodafone side because the AT command to CGCONTRDP is not returning any DNS address. What do you think?

    +CGCONTRDP: 1,5,"pycom.io.MNC028.MCC901.GPRS","10.200.1.108.255.255.255.255","","","","",""



  • Hi,
    Can you check for me the modem firmware using the following:

    import sqnsupgrade; sqnsupgrade.info()
    

    The modem firmware should start with LR6.xx for NB-IoT

    Gijs



  • Hi,
    Sorry for the slow reply. I have never actually used a Pycom simcard myself, so details might vary.

    The Pycom simcards are purposed to only connect using pycom services (pybytes mqtt), so the DNS request with google could indeed show as an EAI_FAIL error.

    I checked last week with our services and the DNS to pybytes should work as expected. Next to that we have not received any other complaintes on this part. I still believe it is weird the Pybytes mqtt connection is not resolving correctly. Maybe @Xykon can help us out here?

    Gijs



  • @Gijs Hello, the problem I've found is related to DNS, do you know how to handle it?.
    If I use socket.getaddrinfo("google.com", 80)[0][-1]), I obtain the same OSError: [Errno 202] EAI_FAIL

    The same sofware tested with the wifi connection is working fine, so the problem is in the modem side and in the DNS.
    Any idea?



  • @Osquillar
    Below the modem answer to AT+CGCONTRDP:
    +CGCONTRDP: 1,5,"pycom.io.MNC028.MCC901.GPRS","10.200.1.108.255.255.255.255","","","","",""



  • @Gijs said in Error while connecting pybytes with LTE:

    mqtt.pybytes.pycom.io

    Hello Gijs,
    I've tried to connect with mqtt.pybytes.pycom.io in port 1883 and there is no problem if I use a wifi connection but I obtain the same OSError: [Errno 202] EAI_FAIL when I execute the same code with the LTE attached.
    It seems as if the NB-IOT network is not allowing to connect to the internet.
    Any other idea?.



  • Are you able to make a manual connection by using:

    from network import LTE
    lte = LTE()
    lte.attach(band=20, apn="pycom.io")
    ...
    

    And then create a socket connection to mqtt.pybytes.pycom.io
    Let me know!
    Gijs



  • Hi,
    In pybytes_config.json file, with "network_preferences": ["lte","wifi"] and "lte": {"apn": "pycom.io", "cid": 1, "reset": false, "carrier": "standard", "band": 20, "type": "IP"}
    I have the following message at any time I try.

    LTE is_connected()
    LTE connection established
    connect_lte with start_mqtt is now removed please call communication_protocol or start_mqtt directly
    MQTT Protocol
    Socket create error: [Errno 202] EAI_FAIL
    This is PybytesProtocol.start_MQTT
    Socket send error [Errno 128] ENOTCONN
    Socket create error: [Errno 202] EAI_FAIL

    If I swap the network preferences order to "wifi","lte", I'm able to send the signal to pytbytes without any problem.



  • The EAI_FAIL error is caused by the DNS not resolving (Error Address Info).. Maybe we had a second of downtime on the Pybytes servers.. Are you able to try it again?


Log in to reply
 

Pycom on Twitter