Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Which QNetworkReply error for connection timeout ?



  • Hello,

    I am trying to catch in a similar way connection timeout error when sending a request to a non-existing server between MinGW and WASM in the QNetworkAccessManager::finished signal.

    Here are the results of the tests I have made (request to a non-existing server) :

    With QNetworkAccessManager::setTransferTimeout(3000) :

    MinGW : QNetworkReply::OperationCanceledError
    WASM : QNetworkReply::ProtocolFailure

    Without

    MinGW : QNetworkReply::UnknownNetworkError
    WASM : QNetworkReply::ContentNotFoundError

    We can see that there is not a common error.

    My question is, how could I differentiate a timeout error and a server who return an error ?

    I am using Qt 5.15.2



  • I just saw that a QNetworkReply::TimeoutError code exists. Shouldn't this code be set when a timeout occurred ? Is this a bug or did I misunderstand something ?