MQTT connection error

Hi, as I am beginner, will be please anybody kindly help me with my first project?

I'd like to connect to an MQTT broker available at 89.24.xxx.xxx:2223 (mosquitto 2.0.18) and send tome topics to it. Initially, without TLS. I am able to connect to the mqtt broker with another client (Android app MyMQTT) successfully and subscribe/publish messages.

I have combined some code samples (below), I am successfull in connecting to LTE-M, getting IP address and getting http get response, but MQTT connect ends in -106 error.

Thank you very much in advance!

Martin

Here is what I get:



My code:

#include <zephyr/kernel.h>
#include <modem/lte_lc.h>
#include <modem/modem_info.h>
#include <modem/nrf_modem_lib.h>
#include <date_time.h>
...
Edit:
Based on the answer below, the code was removed from the ticket as not relevant.
m
Parents
  • Hi Martin,

    Welcome to the world of MQTT projects! Since you can connect to LTE-M and successfully receive an HTTP response, your cellular connection is probably working correctly. The `-106` error may be related to the MQTT configuration, broker connection, or the network socket settings, depending on which MQTT library and modem you are using.

    I would recommend checking the broker address and port, verifying that the MQTT client is configured for a plain TCP connection without TLS, and confirming that the broker allows connections from your device. It would also help to check the library documentation for the exact meaning of error `-106`.

    Could you share the relevant MQTT connection code, along with the modem and MQTT library you are using? That would make it much easier to identify the cause.

    Good luck with your first project!

    basketball games

Reply
  • Hi Martin,

    Welcome to the world of MQTT projects! Since you can connect to LTE-M and successfully receive an HTTP response, your cellular connection is probably working correctly. The `-106` error may be related to the MQTT configuration, broker connection, or the network socket settings, depending on which MQTT library and modem you are using.

    I would recommend checking the broker address and port, verifying that the MQTT client is configured for a plain TCP connection without TLS, and confirming that the broker allows connections from your device. It would also help to check the library documentation for the exact meaning of error `-106`.

    Could you share the relevant MQTT connection code, along with the modem and MQTT library you are using? That would make it much easier to identify the cause.

    Good luck with your first project!

    basketball games

Children
No Data
Related