[Qt-interest] QTcpSocket::QIODevice::readAll() HTTP Response Broken into Pieces

neel.basu.z at gmail.com neel.basu.z at gmail.com
Tue Apr 7 20:22:57 CEST 2009


On Tuesday 07 April 2009 17:27:56 Thiago Macieira wrote:
> Em Terça-feira 07 Abril 2009, às 13:46:36, Neel Basu escreveu:
> > When I am sending "ONE" request to SomeHost on Port 80
> > I should get "Only ONE" Response (Please Correct Me If I am wrong on this
> > point) Holding the Response Headers and Response data.
> 
> You're not correct :-)
> 
> TCP data comes in packets and they form a stream. Due to the way the packets 
> are broken down, you may receive in many different chunks of data or just one. 
> It really depends on how fast you're reading the data.
> 
> If your application waited 10 minutes before trying to read, I'm sure it would 
> receive everything in one single call to readAll().
> 
Thanks for Correcting me.
Assuming a "StatefULL" Protocol makes large Response.
So in that Case.
If I send

Request1
Request2

I might get 

Response1.part1
Response1.part2
Response1.part3
Response1.part4
Response2.part1
Response2.part2

[I donno in advance how many parts will be there for response1 or response2
So there is no Clue for me to understand who's response it is
other than mutually understood texts.]

So How to deal with this Scenario.

If It was Stateless I could just wait for the Signal readChannelFinished() Right ??

Thanks
Neel




More information about the Qt-interest-old mailing list