[Qt-interest] does QAbstractSocket::disconnectFromHost() wait untill all data has been read ??

Thiago Macieira thiago.macieira at trolltech.com
Thu Mar 12 18:07:10 CET 2009


neel.basu.z at gmail.com wrote:
>assuming I invoked QAbstractSocket::disconnectFromHost() just after
> writting all requests.
>e.g. I am looping through QList<QString> and writting each element of
> the vector to the socket.
>and when the loop finished I executed disconnectFromHost().
>On the manual it says it garant's all data will be written before its
> closed. But If the server is going to send some response after
> recieving the last request would it reach to me ????

That depends.

QAbstractSocket will disconnect as soon as the last byte has been written 
to the socket. Anything received until that last byte will be available 
for reading, but not anything after.

>cause when the last request has gone to server there is no unwritten
> data in the buffer so disconnectFromHost() has no problem to close
> (according to documentation).
>So what will happen with the response that was coming from server.

It will not be seen. You need to wait for that data without 
disconnectFromHost().

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090312/3b2480cc/attachment.bin 


More information about the Qt-interest-old mailing list