[SOLVED] QNetworkAccessManager::get timeout?
-
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
-
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
-
You can create your own web server (for example with Python SimpleHTTPServer and simulate a long time response
-
Thanks mcosta!