Qt MQTT and while loop
Solved
General and Desktop
-
Hello!
I' m using Qt Mqtt on Windows and I have troubles to publish a message in a while loop.
For example:
int n=0; while (n<5){ qDebug()<<Q_FUNC_INFO<<endl; mClient->publish(QMqttTopicName(topic.toString()),data.toByteArray()); Sleep(20000); n++; }
with this code, publishments are all made at the same time and after exiting the while loop. But this is not what I want, I would like a publishement every 2 seconds during the execution of the while loop.
Thank you in advance for telling me how to achieve this.
guigiidre