[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:       "Friedrich W. H. Kossebau" <kossebau () kde ! org>
Date:       2008-09-19 0:35:35
Message-ID: 200809190235.35902.kossebau () kde ! org
[Download RAW message or body]

Hi Michael,

is your clock broken, too? :)

Am Freitag, 19. September 2008, um 02:14 Uhr, schrieb Michael Leupold:
> Hi Friedrich,
>
> On Friday 19 September 2008, Friedrich W. H. Kossebau wrote:
> > I want to move large data structures over the internet, as part of a
> > custom protocol over TCP. Being a newbie on asynchronous i/o over a
> > volatile connection I am also a little bit lost how to use Qt/KDE for
> > this. 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.
>
> I'm not entirely sure, but I guess you might be able to connect the
> socket's readyRead signal to a method that reads the data using a
> QDataStream.

I guess the signal readyRead might just be emitted whenever a new tcp packet 
has arrived. It does not seem to guarantue a certain size of bytes available.

> Using google codesearch I found out that libkdegames does something quite
> similar:
> http://websvn.kde.org/trunk/KDE/kdegames/libkdegames/kgame/kmessageio.cpp
> (check KMessageSocket::processNewData() and KMessageSocket::initSocket()).

I had a look there already, the engine operates by sending QByteArrays around, 
with the size first. But this means one extra copy of the data, both at the 
sender and the receiver. As my data could be very large (>MB) I would like to 
stream directly to and from the data structures, perhaps also using external 
storage if useful. So KGame classes do not help me too much (besides getting 
me into the topic ;).

> Not sure how well it handles big amounts of data. From your reader-method
> you could then emit a signal to process the data.
>
> I hope that's remotely what you were looking for.

Thanks, not as much as I want, sorry. Next try? :)

Friedrich
-- 
Okteta - KDE 4 Hex Editor - http://utils.kde.org/projects/okteta
 
>> 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