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
  • Cloudmqtt accepts data in JSON format. So I need to check this  point

  • we tried again with ipv6 the mqtt now gets connected with test.mosquitto.org but gives following error

    LTE Link Connected!
    attempting to connect: IPv6 Address found 2001:41d0:a:fed0::1
    hello
    [mqtt_evt_handler:170] 
    MQTT client connected!
    Subscribing to: my/subscribe/topic len 18
    ERROR: mqtt_live -11
    [mqtt_evt_handler:176] 
    MQTT client disconnected 0
    attempting to connect: IPv6 Address found 2001:41d0:a:fed0::1

    but if we try cloud mqtt it get stuck with error 

    ERROR: getaddrinfo failed -11mqtt_connect -47

  • What is CloudMQTT

    CloudMQTT are managed Mosquitto servers in the cloud which provides lightweight methods of carrying out messaging using a publish/subscribe message queueing model.  -- This I have found in their website. For more details, please check  at https://www.cloudmqtt.com/docs/faq.html 

  • You can contact them and ask specifically. That website didn't list any info related to ipv6.

    If you do a dns lookup on the mqtt broker nameserver, you should see if it supports IPv6 or not, provided that you have a ipv6 connection on your end.

     

    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 

  • As you advised, I wrote to cloudmqt and they specifically told me that their broker do not support ipv6. But the current broker we are using supports  both ipv6  and  ipv4. Is there any AT command to check the broker? 

Reply Children
Related