QNetworkReply Error Timeout

  • I'm using a QNetworkAccessManager to create a QNetwork reply via a post.

    I then connect the error signal of the QNetworkReply to a slot which I am going to use to handle errors.

    The error I am testing for right now is QNetworkReply::TimeoutError.

    I start my application and then unplug the ethernet cable. The post is sent and the QNetworkReply is generated but the QNetworkReply::TimoutError is never sent.

    Can anyone tell me what I'm doing wrong?

    Send the post
    @QNetworkReply* reply = m_app->sendRequestList(m_request, m_configPrefs->password().toStdString());
    connect(reply, SIGNAL(finished()), this, SLOT(checkReply()));
    connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(replyError(QNetworkReply::NetworkError)));@

    Error Handler
    @void XmlPost::replyError(QNetworkReply::NetworkError errorCode)
    QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
    case QNetworkReply::TimeoutError:

  • In case you pull the network cable, the interface usually goes down. You should check for other errors too, it's very likely that you get something like "no route to host" or something similar.

  • I occasionally get a QNetworkReply::UnknownNetworkError but that is the *ONLY * error which is ever reported by the error signal.

    I am using 4.7.4.

  • Sounds reasonable. The actual error (if any) depends on the conditions of the interface, the behavior of the operating system, etc.

  • QNetworkReply::UnknownNetworkError being the only error generated by the QNetworkReply, regardless of the actual error, is working as intended? Weird.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.