# mqttClientService on Legato framework 21 connection problems

**URL:** <https://forum.legato.io/t/mqttclientservice-on-legato-framework-21-connection-problems/6399>\
**Category:** Legato Application Framework\
**Created:** [January 12, 2023, 6:00am UTC](https://forum.legato.io/t/mqttclientservice-on-legato-framework-21-connection-problems/6399 "2023-01-12T06:00:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunil.somarajan](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sunil.somarajan](https://forum.legato.io/u/sunil.somarajan)\
**Post date:** [January 12, 2023, 6:00am UTC](https://forum.legato.io/t/mqttclientservice-on-legato-framework-21-connection-problems/6399/1 "2023-01-12T06:00:27Z")

</div>

Hi,

I managed to compile the mqttClientService on legato 21.0

Once I run an app that tries to use the mqtt\_api I see the following

```auto
Jan 11 21:55:34 fx30s user.info Legato: INFO | cloudcomm[5420]/cloudcomm T=main | cloudcomm.c _cloudcomm_COMPONENT_INIT() 441 | MQTT connection failed, retrying! error -6
Jan 11 21:56:34 fx30s user.info Legato: INFO | cloudcomm[5420]/cloudcomm T=main | cloudcomm.c _cloudcomm_COMPONENT_INIT() 422 | trying to connect ...
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | =========================================================
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | Trace Output
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | Product name: Eclipse Paho Synchronous MQTT C Client Library
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | Version: 1.3.0
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | Build level: Wed Jan 11 15:53:22 PST 2023
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | OpenSSL version: OpenSSL 1.1.1l 24 Aug 2021
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | OpenSSL flags: compiler: arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=softfp -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-securit
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | used-debug-types -fmacro-prefix-map= -fdebug-prefix-map= -fdebug-prefix-map= -fdebug-prefix-map= -DOPENSSL_USE_NODELETE -DOPENSSL
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | OpenSSL build timestamp: built on: Tue Aug 24 13:38:47 2021 UTC
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | OpenSSL platform: platform: linux-armv4
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | OpenSSL directory: OPENSSLDIR: "/usr/lib/ssl-1.1"
Jan 11 21:56:34 fx30s user.info Legato: INFO | mqttClientService[2938] | =========================================================
Jan 11 21:56:35 fx30s user.notice kernel: [1720.590988] audit: type=1400 audit(1673502995.697:18): lsm=SMACK fn=smack_inode_permission action=denied subject="app.mqttClient" object="admin" requested=x pid=2938 comm="mqttClientServi" name="ssl" dev="ubifs" ino=27476
Jan 11 21:56:36 fx30s user.notice kernel: [1721.592905] audit: type=1400 audit(1673502996.697:19): lsm=SMACK fn=smack_inode_permission action=denied subject="app.mqttClient" object="admin" requested=x pid=2938 comm="mqttClientServi" name="ssl" dev="ubifs" ino=27476
Jan 12 05:56:37 fx30s user.warn Legato: -WRN- | mqttClientService[2938]/mqttClientService T=main | mqttClientService.c mqtt_Connect() 405 | Socket error
Jan 11 21:56:37 fx30s user.info Legato: INFO | cloudcomm[5420]/cloudcomm T=main | cloudcomm.c _cloudcomm_COMPONENT_INIT() 441 | MQTT connection failed, retrying! error -6

```

cloudcomm is the app using mqtt.api

I verified that time is set properly on the device. I am using secure connection to connect to the broker.

Any ideas?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [January 12, 2023, 6:24am UTC](https://forum.legato.io/t/mqttclientservice-on-legato-framework-21-connection-problems/6399/2 "2023-01-12T06:24:52Z")

</div>

can you try with local broker (192.168.2.3) first?

> [@How to use component 3rdParty paho.mqtt.c](https://forum.legato.io/t/how-to-use-component-3rdparty-paho-mqtt-c/5612/19):
>
> it worked very well with the local broker (192.168.2.3) but when trying to use a remote broker on the internet, I get the following error: URL: tcp://mqtt.dioty.co:1883 ========================================================= Feb 19 10:45:31 fx30s user.info Legato: INFO | mqttClientService[4328] | Trace Output Feb 19 10:45:31 fx30s user.info Legato: INFO | mqttClientService[4328] | Product name: Eclipse Paho Synchronous MQTT C Client Library Feb 19 10:45:31 fx30s user.inf…
