[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: How to move large data inside a protocol over tcp using Qt/KDE?
From:       Thiago Macieira <thiago () kde ! org>
Date:       2008-09-19 6:29:13
Message-ID: 200809190829.19615.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


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.

Otherwise, I'd recommend just using raw data. Don't use QDataStream.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["signature.asc" (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic