PDA

View Full Version : loss of data recieved using http->readAll()



arunredi
25th June 2008, 03:05
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:


QByteArray ba;
ba=http->readAll();

jacek
25th June 2008, 22:25
When these statements are executed? Are they in some slot? If yes, what signal triggers it?

arunredi
26th June 2008, 01:59
Here is how I'm doing this...



void snipit::somefunkyStuff()
{
http = new QHttp(this);
connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
this, SLOT(readResponseHeaderCita(const QHttpResponseHeader &)));
connect(http, SIGNAL(readyRead(const QHttpResponseHeader&)),
this, SLOT(readyReadCita(const QHttpResponseHeader&)));
-- some more code to do the http->request()
}

void snipit::readyReadCita( const QHttpResponseHeader &resp)
{ QByteArray ba;
ba=http->readAll();
QString temp1=ba;
QMessageBox::critical(this, "SNiPiTRON", temp1, QMessageBox::Ok,
QMessageBox::NoButton, QMessageBox::NoButton);
}

aamer4yu
26th June 2008, 06:35
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 ??

mcosta
26th June 2008, 10:07
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

arunredi
26th June 2008, 17:12
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?