[Qt-interest] QNetworkReply readyRead() doesn't fire

Scott Aron Bloom Scott.Bloom at onshorecs.com
Fri Oct 29 17:56:31 CEST 2010


Your QNetworkAccessManager goes out of scope, and is killing the
connection...

Make the QNAM a member variable of the class

Scott

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Alex Ivasyuv
Sent: Friday, October 29, 2010 8:51 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] QNetworkReply readyRead() doesn't fire

Hi,

I can't resolve an issue with simple HTTP request in QT.

     void Connection::doSmth() {
       QNetworkAccessManager manager;

       QNetworkRequest request;
       request.setUrl(QUrl("http://example.com/"));

       this -> reply = manager.get(request);
       connect(reply, SIGNAL(readyRead()), this, SLOT(httpFinished()));
     }

     void Connection::httpFinished() {
       cout << 1 << endl;
       //      cout << this -> reply -> readAll().data() << endl;
     }

Problem, that httpFinished method doesn't fired at all.

What's wrong with my code?

Thanks in advance,

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list