# Connecting to cluster on HiveMQ cloud using Paho C client

**URL:** <https://community.hivemq.com/t/connecting-to-cluster-on-hivemq-cloud-using-paho-c-client/565>\
**Category:** HiveMQ Cloud\
**Created:** [June 4, 2021, 9:16am UTC](https://community.hivemq.com/t/connecting-to-cluster-on-hivemq-cloud-using-paho-c-client/565 "2021-06-04T09:16:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harsha](https://avatars.discourse-cdn.com/v4/letter/h/e274bd/32.png) [@Harsha](https://community.hivemq.com/u/Harsha)\
**Post date:** [June 4, 2021, 9:16am UTC](https://community.hivemq.com/t/connecting-to-cluster-on-hivemq-cloud-using-paho-c-client/565/1 "2021-06-04T09:16:30Z")

</div>

Hi,

I am unable to connect to HiveMQ cluster using Paho C client

> **[Eclipse Paho | The Eclipse Foundation](https://www.eclipse.org/paho/index.php?page=clients%2Fc%2Findex.php)**
>
> The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 375 open source projects, including runtimes, tools and frameworks.

I tried using the following URL

“mqtts://b2875e8f26514134af6a25b6a3dfa45a.s1.eu.hivemq.cloud:8883”

and

“tcp://b2875e8f26514134af6a25b6a3dfa45a.s1.eu.hivemq.cloud:8883”

…with appropriate username and password

but the client is not able to connect to the broker.

Return code is -1 which means “A generic error code indicating the failure of an MQTT client operation.” according to the following link.

[https://www.eclipse.org/paho/files/mqttdoc/MQTTClient/html/\_m\_q\_t\_t\_client\_8h.html#af33a6d6c0e8a6a747bf39638e0bba36b](https://www.eclipse.org/paho/files/mqttdoc/MQTTClient/html/_m_q_t_t_client_8h.html#af33a6d6c0e8a6a747bf39638e0bba36b)

Please advice.

Thanks.

Regards,  
Harsha

---

<div class="post-metadata">

**Author:** ![SShet](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@SShet](https://community.hivemq.com/u/SShet)\
**Post date:** [June 10, 2021, 2:14pm UTC](https://community.hivemq.com/t/connecting-to-cluster-on-hivemq-cloud-using-paho-c-client/565/2 "2021-06-10T14:14:11Z")

</div>

Hello Harsha,

Thanks for reaching out. I did quick test to connect the HiveMQ cloud cluster Using [MQTT CLI](https://hivemq.github.io/mqtt-cli/). I have followed steps mentioned at [Quick Start Guide](https://www.hivemq.com/docs/hivemq-cloud/introduction.html#connect-client).

If it is feasible, please do a quick test if you can connect the HiveMQ Cloud with MQTT CLI. You may need to contact [Paho mailing list](https://www.eclipse.org/paho/index.php?page=support.php) to get this issue resolved if you can connect broker using MQTT CLI.

Kind Regards,  
Sheetal
