Unsolved Qt Mqtt not connecting
-
Hello,
I have read the documentation and the example code for the Qt Mqtt library.
Now I'm trying to create my own client, but the QMqttClient won't connect to the brokerQMqttClient *client= new QMqttClient(); client->setHostname("192.168.0.137"); client->setPort(1883); client->connectToHost(); QMqttClient::ClientState state =client->state(); while (client->state()==QMqttClient::Connecting);
When debugging the state is always connecting (never connected).
I know the library works (because the example code works).
Is there something I forgot?Thanks in advance,
Lode -
Hi,
You might be strangling the event loop with that
while
loop. -
@lodeSmets said in Qt Mqtt not connecting:
I have read the documentation and the example code for the Qt Mqtt library.
So you have seen that the simpleclient for instance doesn't have any loop, and it's "event-based" using just signals and slots.
And out of curiosity and for statistical purposes, what server (i.e. Mosquitto) are you trying to connect to? Thanks.