# mqttClient Service Connect error?

**URL:** <https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093>\
**Category:** Uncategorized\
**Created:** [April 28, 2021, 10:01am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093 "2021-04-28T10:01:12Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 29, 2021, 9:32am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/25 "2021-04-29T09:32:22Z")

</div>

no idea, never use this application in ubuntu before

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 9:33am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/26 "2021-04-29T09:33:00Z")

</div>

and why you say me to use it? 😀  
Is there a way to see on the terminal if my board can “talk” with mqtt mosquitto broker at the adress tcp://192.168.2.3:1883?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 29, 2021, 9:34am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/27 "2021-04-29T09:34:29Z")

</div>

you are the one decide to use mosquitto , I never ask you to use it

As said before you need to wireshark to capture the traffic

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 9:38am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/28 "2021-04-29T09:38:29Z")

</div>

I can also use AirVantage broker at the adress **tcp://eu.airvantage.net:1883** , but the situation doesn’t change 😥

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/2X/a/a69295d094021d9708ef4fba9bb07ea18409204f.png)

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 29, 2021, 9:40am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/29 "2021-04-29T09:40:30Z")

</div>

you can debug in MQTTClient\_connectAll() and see why it returns SOCKET\_ERROR

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 9:48am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/30 "2021-04-29T09:48:37Z")

</div>

but what have I to debug if this function works well for other users on the forum? I really don’t understand why all is so difficult with this HW

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 9:52am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/31 "2021-04-29T09:52:22Z")

</div>

I read this post:

> [@Avoid sync and the utilization of Octave by implementing another communication protocol](https://mangoh.discourse.group/t/avoid-sync-and-the-utilization-of-octave-by-implementing-another-communication-protocol/6826/11):
>
> I created the mqtt broker by typing on my workspace “systemctl start mosquitto”

This guy uses mosquitto (so I’m not the only one person to use it in the universe 😀) and he has the same problems on the connection, but the solution is not clear

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 29, 2021, 9:53am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/32 "2021-04-29T09:53:48Z")

</div>

other user can work with MQTT:

> [@Sending file over mqtt using mqttClient-for-Legato](https://mangoh.discourse.group/t/sending-file-over-mqtt-using-mqttclient-for-legato/5773):
>
> hi i am using [mqttClient-for-Legato](https://github.com/nhonchu/mqttClient-for-Legato). I am able to publish data. But i am not able to send file using “mqtt pubfile topic filename” It says cannot open file and I have already given all the permissions. Any help would be appreciated Zehra

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 9:54am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/33 "2021-04-29T09:54:54Z")

</div>

I read this:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/2X/9/9b3e7aee3ba629dbd7506761e883201edce0bacc.png)  
Could be this the problem? And is not clear where have I to insert these options in my SW (in .adef?)

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 29, 2021, 9:56am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/34 "2021-04-29T09:56:20Z")

</div>

you need to ask that user, I did not modify that configuration.

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 9:58am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/35 "2021-04-29T09:58:08Z")

</div>

Believe me, I’m sorry, but it’s a tragedy with this HW, everything seems very difficult, it’s a nightmare. I can’t wait to change my project, abandon it and never see it again in life

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 29, 2021, 10:00am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/36 "2021-04-29T10:00:29Z")

</div>

Why don’t you do debug in MQTTClient\_connectAll() for further analysis?  
Why don’t you capture wireshark on server side?

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 10:02am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/37 "2021-04-29T10:02:17Z")

</div>

I try, but I already know it will not lead to any results. Thanks so much for your help

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 29, 2021, 2:09pm UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/38 "2021-04-29T14:09:51Z")

</div>

To be honest, that will not help…  
What if your next project is still difficult, are you going to abandon it again?  
You need to have proper skill and passion to progress.  
You said that you tried and conclude that will not lead to any result, but I wonder if you really tried with wireshark …  
i.e.  
Here at least i can receive the MQTT message in port 1883 with WP76 FW R13:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/2X/8/8ad06a6249fe08e27c337d55b39e335da785d908.png)

So probably your MQTT server is not responding which makes the problem.

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 3:49pm UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/40 "2021-04-29T15:49:28Z")

</div>

Thanks so much for the reprimand. But I see that Mosquitto should be active …

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/2X/0/016b60362627c3c4b7bc25c8b0d4b8130a451be6.png)

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 29, 2021, 4:15pm UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/41 "2021-04-29T16:15:59Z")

</div>

Again that won’t help …

Why don’t you do debug in MQTTClient\_connectAll() for further analysis?  
Why don’t you capture wireshark on server side?

Besides just activating the server, you need to think more ways to debug!!!

As said above, other user had made it work before

> **[How to use component 3rdParty paho.mqtt.c](https://forum.legato.io/t/how-to-use-component-3rdparty-paho-mqtt-c/5612/17)**
>
> Thanks @jyijyi ! Missing free remote access to the test mqtt broker listener 1883 0.0.0.0 allow\_anonymous true Now it’s working properly!

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 5:17pm UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/42 "2021-04-29T17:17:27Z")

</div>

So, I try to rearrange the ideas. The code does not work due to connection problems with the broker. Downstream of the analyzes made today, I am even more convinced that this is the case. Also because, seeing in the old posts (from a month ago) I had exactly the same problem when I unknowingly compiled other people’s code, only that I thought it was a software problem (maybe I didn’t understand something) and then I put myself in a some sense to develop it alone (albeit based on that). So I wonder (and I ask you): having a communication problem with port 1883 (almost certainly) **is there a guide to correctly enter a broker on Ubuntu in order to communicate with mangOH through port 1883**?  
I hope I was clear …

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 29, 2021, 5:29pm UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/43 "2021-04-29T17:29:53Z")

</div>

I don’t want to give the impression of being a slacker, I understood and debugged the code, for me it seems to work well (statistically, by the way, it can only be so, since even when I use other people’s code I have exactly the same problem! ). The problem is definitely on port 1883. In fact I INSTALLED WIRESHARK (I also sent you a screenshot a few hours ago) and it clearly shows that only the mangOH on port 22 is detected and nothing else. If there is something else below, unfortunately I do not have the skills to understand it, I am little more than a student, therefore quite ignorant.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [April 30, 2021, 7:11am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/44 "2021-04-30T07:11:31Z")

</div>

seems your wireshark is not capturing USB ECM interface…  
It should be something like this:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/2X/0/0448dc682eb65102a4241f141ceb47285ba59615.png)

You might also give a try on Mosquitto windows version.

---

<div class="post-metadata">

**Author:** ![gavinoimparato1](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gavinoimparato1](https://mangoh.discourse.group/u/gavinoimparato1)\
**Post date:** [April 30, 2021, 10:45am UTC](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093/45 "2021-04-30T10:45:43Z")

</div>

Do you think it could be a problem of configuration file? I installed mosquitto **using sudo apt-get mosquitto install** , then I can see that mosquitto is running with mnosquitto status:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/2X/a/a85202e09b84b72c540d3b50443a3027985fdd83.png)  
isn’t it enough to make mosquitto (or in general a broker) running on Ububtu VM?

[Previous page](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093.md?page=1)

[Next page](https://mangoh.discourse.group/t/mqttclient-service-connect-error/9093.md?page=3)
