Paho MQTT C Client Issue [message #1763639] |
Thu, 18 May 2017 05:28  |
Eclipse User |
|
|
|
Hi
I am using Paho mqtt C Client application.But in my application execution is getting stuck at MQTTAsync_isConnected api. I am using MQTTAsync_publish.c
Have a look on my code:
if ((rc = MQTTAsync_sendMessage(client, topicName, &pubmsg, &opts)) !=
MQTTASYNC_SUCCESS) {
ERROR("Failed to start sendMessage, return code %d\n", rc);
}
// Check it the client is connected.For application restart case.
if(MQTTAsync_isConnected(client) == true){
// Wait for final response if client is disconnected at the time of
// event.
MQTTAsync_waitForCompletion(client, opts.token, 10000L);
}
Prints:::::::::::::::::::::::::::::::::::::::::
Above lock MQTTAsync_createWithOptions
After unlock out of MQTTAsync_createWithOptions
Inside MQTTAsync_setCallbacks above lock
Inside MQTTAsync_setCallbacks after unlock
Inside MQTTAsync_connect
Inside MQTTAsync_connect above lock checking sendthread status
Inside MQTTAsync_connect beloa unlock checking sendthread status
Inside MQTTAsync_connect above lock checking recvthread status
Inside MQTTAsync_connect beloa unlock checking recvthread status
getting oyt of connect
Debug: Initializing Event DB
Debug: Initialization of Event DB complete
Queue ID: 0
WDM Library : Register with WDM
Debug: Successful connection
Debug: Current HW_VERSION: [1.0.0]
Debug: Current SW_VERSION: [1.0.1]
Debug: MODEL_NAME: [EL76]
Debug: Last Firmware Status: [SUCCESS]
WDM Library : "467.notify-manager-app.20" Sent
Inside MQTTAsync_sendMessage
Inside MQTTAsync_send
Getting out of MQTTAsync_send[0]
Getting out of MQTTAsync_sendMessage [0]
Above mutex lock inside MQTTAsync_isConnected[0]
I just want to check if the client is connected or not with the server in my application but execution is getting stuck inside this api.
Can somebody help me with this?
|
|
|
|
|
Re: Paho MQTT C Client Issue [message #1764054 is a reply to message #1764016] |
Wed, 24 May 2017 08:31  |
Eclipse User |
|
|
|
You shouldn't call waitForCompletion within a callback. It's the only synchronous call within this API, a late addition which I didn't originally plan for. I'll have to update the doc for that.
|
|
|
Powered by
FUDForum. Page generated in 0.04153 seconds