This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MQTT Sample code is not connecting

The sample code at ncs/nrf/samples/nrf9160/mqtt_simple is not connecting. I dod not make any changes to the ode. I am using NB-IoT. LTE is connected. The link monitor, LTE is in green. The error code is ERROR: mqtt_connect -60

Kindly advice to resolve this

Parents Reply Children
  • OK, will  do that. The code given by you works and connects to test.Mosquito.com 

  • Still the same error. 

    The MQTT simple sample startedLTE Link Connecting ...AT+CFUN=1OKAT+CFUN?+CFUN: 1OK+CEREG: 2,"FFFE","FFFFFFFF",7,0,0,"11100000","11100000"+CEREG: 0,"FFFE","FFFFFFFF",7,0,0,"11100000","11100000"+CEREG: 2,"C0D8","003AC006",9,0,0,"11100000","11100000"+CSCON: 1+CEREG: 5,"C0D8","003AC006",9,,,"11100000","11100000"LTE Link Connected!attempting to connect: ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hellomqtt_connect -47

  • Have you checked with your mqtt provider that they support ipv6?

     

    Kind regards,

    Håkon

  • Still I am not able to connect

    5 NRF_REGULATORS       Non-SecureOKSPM: NS image at 0xc000SPM: NS MSP at 0x20025e80SPM: NS reset vector at 0x10295SPM: prepare to jump to Non-Secure image.*** Booting Zephyr OS build v2.4.0-ncs1  ***The MQTT simple sample startedLTE Link Connecting ...[00:00:00.201,629] [1;33m<wrn> net_dns_resolve: Cannot initialize DNS resolver (-22)[0m[00:00:00.232,543] [0m<inf> lte_lc: Using legacy LTE PCO mode...[0m+CEREG: 2,"FFFE","FFFFFFFF",7,0,0,"11100000","11100000"+CEREG: 0,"FFFE","FFFFFFFF",7,0,0,"11100000","11100000"[00:10:00.265,472] [0m<inf> lte_lc: Network connection attempt timed out[0m[00:10:00.280,212] [0m<inf> lte_lc: Using fallback network mode[0m+CEREG: 2,"C0D8","003AC006",9,0,0,"11100000","11100000"+CSCON: 1+CEREG: 5,"C0D8","003AC006",9,,,"11100000","11100000"LTE Link Connected!attempting to connect: ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hellomqtt_connect -47ERROR: getaddrinfo failed -11hello
    
    mqtt_simple_reconnect.zip to server other than mosquitto. I am  sharing the code and error log. Kindly check. 

  • vkadal said:
    server other than mosquitto. I am  sharing the code and error log. Kindly check. 

    As mentioned, the broker must also support ipv6, as your nb-iot network only supports ipv6. Can you please ensure that you are connecting to a broker that also supports ipv6?

     

    Kind regards,

    Håkon 

Related