PDA

View Full Version : QNetworkAccessManager keep-alive ?



tsuibin
5th May 2016, 15:26
I'm use QNetworkAccessManager to visit couchdb


http://127.0.0.1:5984/chat/_changes?feed=continuous&since=1

couchdb args continuous means http keep-alive



m_getContinuousManager = new QNetworkAccessManager(this);

connect(m_getContinuousManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(newMsg(QNetworkReply*)));







void newMsg(QNetworkReply *reply)
{
qDebug() << reply->readAll()

}


but my function newMsg only exec once

anda_skoa
5th May 2016, 16:33
Right.
If the "continuous" means that the connection is kept open, your slot shouldn't be called at all.

Maybe the server does end the HTTP request?

Cheers,
_

Sashabn
6th May 2016, 12:05
Did you try to repeat your code
m_getContinuousManager = new QNetworkAccessManager(this);
connect(m_getContinuousManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(newMsg(QNetworkReply*)));
in newMsg?