[Qt-interest] Socket communication without threads

Scott Aron Bloom Scott.Bloom at sabgroup.com
Tue Mar 3 21:17:07 CET 2009


> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Roland Krause
> Sent: Tuesday, March 03, 2009 12:10 PM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Socket communication without threads
> 
> > You really expect the network driver or glibc or Qt to have buffers
in
> memory
> > of several hundred megabytes???
> 
> Certainly not the network driver, not sure what glibc has to do with
it or
> whether but from the documentation of Qt where it says that there is
by
> default unlimited buffering, yes, that's exactly what I had expected.
I guess
> I was mislead by high-level communication protocols such as MPI.
> 
> > Still no need for threads. Just create your own buffer which you
append data
> to
> inside the slot connected to readyRead(). Once a full dataset is in
the buffer
> you can trigger processing (while the next dataset might be appended
by
> readyRead()).
> 
> That's actually what I would expect the Qt function to do :-) As I
said, I
> wanna try this with a QTcpSocket next before i consider it a bigger
problem :-
> )
> 
> > Why would you want several (explicit) threads when you already
> have several apps (the same as threads only they each have their own
memory
> section)?
> 
> :-) That's a bit of a difference - and I do currently not use threads
here.
> 
> Roland
> 
> 
> 

I think your confusing "readyRead" with buffer full...

You can ignore the readyyRead signal, and simply wait for the socket to
be finished... It will keep buffering just fine.. right up till you run
out of memory.

The readyReady is signaled when SOMETHING is available, that you may or
may not want to handle.

Scott




More information about the Qt-interest-old mailing list