Important: Please read the Qt Code of Conduct -

QNetworkRequest or QNetworkReply timeout

  • From what I can find and what I see in my tests, QNetworkRequest still doesn't have a timeout (QT 5.1 in my case). Is that true? But why does the NetworkError then have a TimeoutError?

    Edit: actually, I do see now that a timeout can occur, it's just very long. I can't seem to find a way to set a timeout to another value. Is there a way?

  • Maybe you can start an extra timer for checking the state, stopping the request... ?

  • I use timers now, but it's error prone and a bit clunky. You can forgot to connect QTimer::timeout() to QNetworkReply::deleteLater, or to connect QNetworkReply::finished to QTimer::stop, or any other boiler plate code. If you do, you get very weird effects, such as your normal slots being activated after timeout already having occurred.

    There is an open bugreport about it, on which I commented.

Log in to reply