Answer the question
In order to leave comments, you need to log in
How to implement request completion wait with QNetworkAccessManager in Qt?
There are examples on the Internet on how to implement it by connecting the slot to the QNetworkReply::finished signal with QEventLoop, but I did not find it with QNetworkAccessManager::replyFinished. Inside the handler, after receiving the data, another request is sent based on them and this is repeated.
I also wanted to know how to set a timeout. If it fails to connect within 3 seconds, it sends another request.
Answer the question
In order to leave comments, you need to log in
QNetworkAccessManager manager;
QEventLoop loop;
QObject::connect(&manager, QOverload<QNetworkReply*>::of(&QNetworkAccessManager::finished),
&loop, &QEventLoop::quit);
...
loop.exec();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question