[Qt-interest] slot connected to QAbstractSocket::QIODevice::readyRead () recieves multiple responses at once

Arnold Krille arnold at arnoldarts.de
Wed Apr 15 14:44:05 CEST 2009


On Wednesday 15 April 2009 14:22:05 Neel Basu wrote:
> Well Two non-Qt Question and 1 Qt Question:
> is it Mandatory for a Protocol to end all of its messages with CRLF or with
> any Specified tailer

Whether messages are limited with CRLF or not is defined in the protocol, not 
in Qt. And as there are different protocols, there are different ways to do 
this.

> If a big response is splitted into multiple messages would they have the
> same Acknowledgement Number

That again is part of TCP/IP (if I am not mistaken). You won't be bothered 
with any of this in Qt or in any protocol on top of TCP/IP.

> will bytesAvailable() methods return the size of first message or all
> messages currently stored in the buffer in the above mentioned Scenario.

Again, Qt doesn't know anything about your messages, it just knows about 
bytes. And bytesAvailable() returns the bytes available for reading. Nothing 
more, nothing less.

What you make of these bytes, whether you split them into messages or dump 
them to disk or forget them altogether is up to you.

A small hint for parsing your messages from the stream: With peek() you can 
read the bytes available and check for the presence of your message-separator 
without reading the bytes from the buffer...

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090415/745491af/attachment.bin 


More information about the Qt-interest-old mailing list