Am Freitag, 19. September 2008, um 08:29 Uhr, schrieb Thiago Macieira: > Friedrich W. H. Kossebau wrote: > >The protocol is a custom one, so I thought I just use QDataStream on > >QTCPSocket everywhere. But how will this work if the data doesn't come > > as fast over the network as the other side reads it, so the buffer is > > underrun? (Or is this no problem, does QDataStream just wait? I found > > no hint to a Timeout, which would be nice to have, then). The Qt > > examples do not seem to use QDataStream that way, too. > > QDataStream wants the entire datastream block before you start reading. If > you are *sure* you received everything that QDataStream wrote, you can > use it. That's usually done by placing a size marker at the beginning of > the data, before the datastream itself. Okay, so I understand the docs correctly. Hm. Involves another copy of the data. Now, if I buy into this, I still have the problem to calculate the size on the sender side: Is there a way to do get the streaming size of a data structure _before_ I stream it with QDataStream? (If not, I would like to request this feature). > Otherwise, I'd recommend just using raw data. Don't use QDataStream. Buhu :( Thanks for the answer, even if it does not please me ;) I think it would be very cool if there will be a mechanism one day in Qt which is also able to read data structures from such sequential waiting-involved data sources, with an easy API for the Qt user, please note this somewhere at Qt Software :) QDataStream looked so nice, now I feel really uneasy having to do all the lowlevel work myself ;) Now I see that even QFile is also not really QDataStream-safe, as I have thought before (as in "not thought about"). Ouch. Cheers Friedrich -- Okteta - KDE 4 Hex Editor - http://utils.kde.org/projects/okteta >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<