Results 1 to 6 of 6

Thread: loss of data recieved using http->readAll()

  1. #1
    Join Date
    Apr 2008
    Location
    California
    Posts
    25
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question loss of data recieved using http->readAll()

    For a reason unknown to my understanding, when reading from http response into QByteArray. can anyone point me in the right direction? Is this a conversion issue?

    here is the code snip:
    Qt Code:
    1. ba=http->readAll();
    To copy to clipboard, switch view to plain text mode 
    - AR

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: loss of data recieved using http->readAll()

    When these statements are executed? Are they in some slot? If yes, what signal triggers it?

  3. #3
    Join Date
    Apr 2008
    Location
    California
    Posts
    25
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: loss of data recieved using http->readAll()

    Here is how I'm doing this...

    Qt Code:
    1. void snipit::somefunkyStuff()
    2. {
    3. http = new QHttp(this);
    4. connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
    5. this, SLOT(readResponseHeaderCita(const QHttpResponseHeader &)));
    6. connect(http, SIGNAL(readyRead(const QHttpResponseHeader&)),
    7. this, SLOT(readyReadCita(const QHttpResponseHeader&)));
    8. -- some more code to do the http->request()
    9. }
    10.  
    11. void snipit::readyReadCita( const QHttpResponseHeader &resp)
    12. ba=http->readAll();
    13. QString temp1=ba;
    14. QMessageBox::critical(this, "SNiPiTRON", temp1, QMessageBox::Ok,
    15. QMessageBox::NoButton, QMessageBox::NoButton);
    16. }
    To copy to clipboard, switch view to plain text mode 
    - AR

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: loss of data recieved using http->readAll()

    Whats the loss ?? What do u expect and what do u get ??
    also make sure wheter u are getting data in chunks or not. If yes have u handled code for chunk data ??

  5. #5
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: loss of data recieved using http->readAll()

    When you receive readyRead signal you must control the size of data available with QHttp::bytesAvailable()
    You can return when bytes Available aren't sufficient for your computation
    A camel can go 14 days without drink,
    I can't!!!

  6. #6
    Join Date
    Apr 2008
    Location
    California
    Posts
    25
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: loss of data recieved using http->readAll()

    Hello!

    Thank you for your responses. I believe I understand what is wrong with my logic. Do you happen to have a code snippit which will help me understand the handling of response better?
    - AR

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.