[Qt-interest] Socket communication without threads

Predrag Manojlovic pedjaman at gmail.com
Tue Mar 3 12:16:17 CET 2009


Thiago Macieira wrote:
> Predrag Manojlovic wrote:
>> To be more precise:
>> 1. First client connects
>> 2. sendFortune() slot is triggered and takes time (read large data from
>> file and send to socket), are other clients waiting? Or we have multiple
>> sendFortune() instances working at same time?
> 
> You shouldn't have to ask this. If there's only one thread running, while 
> that thread is doing some work, no other work is being done.
> 
> The question is then: why are you taking so much time? If your processing 
> operation does take that much time, then yes, use a thread. Otherwise, 
> maybe you should consider splitting the work?
> 
I asked because it is not documented well and many people are talking
that threads should not be used at all in socket applications. So I
assumed there is maybe thread created for every incoming connection in
QTcpServer.
I just needed to clarify.

Thank you
Predrag



More information about the Qt-interest-old mailing list