[Qt-interest] Socket communication without threads

Predrag Manojlovic pedjaman at gmail.com
Mon Mar 2 19:29:33 CET 2009


Sean Harmer wrote:
> On Monday 02 March 2009 17:27:04 Predrag Manojlovic wrote:
>> Hm... let me explain problem on better example:
>>
>> Let me take Fortune Server as example (without threads):
>> And let replace fortune string with much larger data like file content.
>> If i start multiple clients, what will happen?
>> 1. All downloading at same time?
>> 2. One is downloading, other are waiting?
>>
>> I thought that only one client is downloading data...
>>From the docs for QIODevice from which QTcpSocket is derived:
> 
> "Certain subclasses of QIODevice, such as QTcpSocket and QProcess, are 
> asynchronous. This means that I/O functions such as write() or read() always 
> return immediately, while communication with the device itself may happen when 
> control goes back to the event loop."
> 
> Does that explain it?
> 
> Sean
> 
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?



More information about the Qt-interest-old mailing list