How to set timout for MQTT Client Connect?

533 views
Skip to first unread message

sujitha

unread,
Mar 5, 2017, 1:36:18 AM3/5/17
to MQTT
Hi,
I am using Mosquitto C client library to connect to MQTT broker. I am connecting using below code.

int rc = mosquitto_connect(m_pMosq, MQTT_HOSTNAME, MQTT_PORT, 0);

What I need to do is I have to set timeout value manually instead of client decide that.

How can I set timeout for MQTT connection?

Likewise how to set timeout value while publishing message. I am using mosquitto_publish api for publishing message.

Thanks in advance. 

kushal bhatta

unread,
Mar 5, 2017, 4:52:15 AM3/5/17
to MQTT
i think what you can do is you can set up a timer for certain interval yourself and check through that whether the timeout condition is satisfied

kushal bhatta

unread,
Mar 5, 2017, 4:55:16 AM3/5/17
to MQTT
So you can create a timer object or you can use the api in c or c++ whichever you are using i think creating objects for yourself would be a better thing to do since you can customize your own features in that timer object of what to do and what not to do
Reply all
Reply to author
Forward
0 new messages