rawfool
19th August 2014, 14:55
I want to do Http Post and retry if in case some error has occured.
HttpEngine::HttpEngine()
{
nwAccMan = new QNetworkAccessManager(this);
connect(nwAccMan, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
QNetworkProxy proxy(QNetworkProxy::HttpProxy, "192.168.1.111", 810, QString("TTR"), QString());
nwAccMan->setProxy(proxy);
nwAccMan->post(QNetworkRequest(QUrl("https://something.com/fll/browseFolder?")), QByteArray("uid=test2_sdaee169&pwd=pass&p=%2f%2f"));
}
void HttpEngine::replyFinished(QNetworkReply * reply)
{
QByteArray data = reply->readAll();
qDebug() << data;
}
In the above code, if in case the reply has some error, I need to try to resend request till a timer timeout with interval of 5 seconds. How can I achieve this ?
Thank you.
HttpEngine::HttpEngine()
{
nwAccMan = new QNetworkAccessManager(this);
connect(nwAccMan, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
QNetworkProxy proxy(QNetworkProxy::HttpProxy, "192.168.1.111", 810, QString("TTR"), QString());
nwAccMan->setProxy(proxy);
nwAccMan->post(QNetworkRequest(QUrl("https://something.com/fll/browseFolder?")), QByteArray("uid=test2_sdaee169&pwd=pass&p=%2f%2f"));
}
void HttpEngine::replyFinished(QNetworkReply * reply)
{
QByteArray data = reply->readAll();
qDebug() << data;
}
In the above code, if in case the reply has some error, I need to try to resend request till a timer timeout with interval of 5 seconds. How can I achieve this ?
Thank you.