[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:       Matthew Woehlke <mw_triad () users ! sourceforge ! net>
Date:       2008-09-19 16:21:42
Message-ID: gb0jim$8de$1 () ger ! gmane ! org
[Download RAW message or body]

Friedrich W. H. Kossebau wrote:
> Am Freitag, 19. September 2008, um 05:51 Uhr, schrieb Matthew Woehlke:
>> Probably Qt polls the socket for you as part of the event loop, hence
>> the readyRead signal. Assuming Qt supports non-blocking sockets (which
>> it *really* should), you just keep trying to read until you get less
>> bytes back than you asked for. Normally you take the little buffers and
>> use them to progressively fill a larger buffer until you have an entire
>> "message".
> 
> Which means another copy of the data, next to the buffer and the target data 
> structure... :/ I want to do it perfect :)

 From Thiago's description, it sounds like Qt does this part of it for 
you. More notes in my reply to him.

>> At that point, you deal with the message, do a memmove to 
>> shift the buffer contents back to the beginning, and repeat until you
>> have reason to stop.
> 
> So far I could follow, but what is that memmove needed for? Which buffer do 
> you mean here?

...because if you don't, you've got a buffer whose useful data starts at 
<some offset> :-). Except (as above) it sounds like Qt is handling this 
part.

>> Hopefully something in the above makes sense :-) and perhaps will cause
>> the examples to make more sense.
> 
> Thanks, completes some part of the puzzle for me. :)

NP :-). Adding Thiago's explanation, I feel like I actually know what 
I'm talking about w.r.t. Qt as well, now :-). Hopefully between the two 
of us we've filled in much of the puzzle.

-- 
Matthew
We are Microsoft. You will be assimilated. Resistance is futile.
   -- Badtech

 
>> 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