Results 1 to 1 of 1

Thread: post method problem

  1. #1
    Join Date
    Sep 2011
    Posts
    45
    Thanks
    17
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: post method problem

    Hello.

    I got a small problem with a post method using QNetworkAccessManager. After sending the data to http-server, I would like to read a response from the server. And here is the problem. After the first response from the server. I can't send any data to the server anymore. Here is the code:

    Qt Code:
    1. void Client::SendData(QIODevice *data)
    2. {
    3. this->reply = this->objectQNetworkAccessManager->post(this->objectQNetworkRequest,
    4. data);
    5. connect(this->reply, SIGNAL(finished()),
    6. this, SLOT(readData()));
    7. }
    8.  
    9. void Client::readData()
    10. {
    11. if(this->reply->error() == QNetworkReply::NoError)
    12. {
    13. qDebug() << "data send";
    14. qDebug() << this->networkReply->readAll();
    15. }
    16. else
    17. {
    18. qDebug() << "error";
    19. }
    20. this->reply->deleteLater();
    21. }
    To copy to clipboard, switch view to plain text mode 

    If I don't try to read any data from QNetworkReply everything works fine...
    What's wrong with the code above?
    Thank you for answers beforehand.


    Added after 4 minutes:


    Sorry for disturbing... I found the answer.

    connect(this->reply, SIGNAL(readChannelFinished()),
    this->reply, SLOT(deleteLater()));
    Last edited by DmitryNik; 7th November 2011 at 20:15.

Similar Threads

  1. QNetworkAccessManager and post method
    By sabbu in forum Newbie
    Replies: 12
    Last Post: 16th June 2011, 23:01
  2. Generint Post Method
    By Ricardo_arg in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2011, 17:41
  3. Method POST using QTcpServer ?
    By fitzy in forum Qt Programming
    Replies: 1
    Last Post: 27th October 2009, 23:36
  4. Http Post method help
    By ravirdv in forum Qt Programming
    Replies: 0
    Last Post: 27th September 2009, 12:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.