[SOLVED] QNetworkAccessManager::get timeout?
-
wrote on 27 Mar 2015, 22:57 last edited by floatingWoods
Hello,
how can I control the timeout of a QNetworkAccessManager::get?
I mean, if there is no internet connection, or the file is not available/reachable, how long will it try before giving up? Do I have a control over the timeout?Thanks
-
Hello,
how can I control the timeout of a QNetworkAccessManager::get?
I mean, if there is no internet connection, or the file is not available/reachable, how long will it try before giving up? Do I have a control over the timeout?Thanks
@floatingWoods Since there is still no built-in way to do that you will have to rely on implementing your own Timers for aborting it after a particular time.
-
Hello,
how can I control the timeout of a QNetworkAccessManager::get?
I mean, if there is no internet connection, or the file is not available/reachable, how long will it try before giving up? Do I have a control over the timeout?Thanks
wrote on 28 Mar 2015, 07:51 last edited by -
wrote on 28 Mar 2015, 13:08 last edited by
Thank you both for the good suggestions!
A last related question: how can I simulate a long timeout? I am trying to get a file with:
networkAccessManager->get(QNetworkRequest(QUrl("http://www.google.com/aFile.txt")));
When I enter an invalid address or an inexistant file, the finished signal is fired after 1-2 seconds only, which wouldn't be a problem. I want to avoid the other, much longer timeouts that can last up to 30 seconds. And to provoque this long waiting time, how should my code line look like?
Thanks
-
wrote on 28 Mar 2015, 13:14 last edited by
You can create your own web server (for example with Python SimpleHTTPServer and simulate a long time response
-
wrote on 28 Mar 2015, 23:56 last edited by
Thanks mcosta!
1/7