[Qt-interest] Why Bus error clientSocket->waitForConnected()?

Arnold Krille arnold at arnoldarts.de
Sun May 2 12:56:53 CEST 2010


On Sunday 02 May 2010 06:36:57 Kustaa Nyholm wrote:
> >http://doc.qt.nokia.com/4.6/qiodevice.html#readLine
> >The word "blocking" doesn't appear in that documentation.
> Which says:
> Data is read until either of the following conditions are met:
> The first '\n' character is read.
> maxSize - 1 bytes are read.
> The end of the device data is detected.
> So my knee jerk reading would be that it should block, but I guess
> it depends on what "end of the device data" means. I would have
> thought that it means the stream is at end but if it means that
> there is no more data available *momentarily*, then it should not
> block of course.

Why should it block? Blocking here would mean to wait for more data. But it 
reads at most until the end of the available data. If no data is available, it 
returns immediately...

> But a readLine that terminates early just because not enough
> data has arrived in time seems pretty useless to me, I would
> *always*  have to wrap this in a loop that checks for a complete
> line having being received. Does not make sense to me.

You can also work with bytesAvailable() and peek() to see whether the data you 
want is in the buffer already.

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/20100502/38212913/attachment.bin 


More information about the Qt-interest-old mailing list