[Qt-interest] Socket communication without threads

Predrag Manojlovic pedjaman at gmail.com
Mon Mar 2 19:51:20 CET 2009


R. Reucher wrote:
> On Mon March 2 2009 19:32:56 Predrag Manojlovic wrote:
>> R. Reucher wrote:
>>> On Mon March 2 2009 18:27:04 Predrag Manojlovic wrote:
>>>> I thought that only one client is downloading data...
>>> In fact, at some point the data is "serialized" anyway, and that's called
>>> multi-plexing. There are better ways to do load-balancing if that's what
>>> you are afraid of... of course you _CAN_ use QThread's to do what that,
>>> but it makes live much harder and there's no real use for what you're
>>> going to achieve.
>>>
>>> Instead, just respond to the signals of the QTcpSocket's... it's surely
>>> fast enough for quite a number of concurrent clients.
>> It is not balancing problem. I do not want clients to wait.
>> So, if sendFortune() slot takes time (processing data etc) are other
>> clients waiting? Or we have multiple sendFortune() instances running?
> Just don't choose a block size of "several giga bytes" when sending data to 
> the clients -- this would make the other clients wait. If you really need to 
> send so much data, send it in smaller blocks... that's all there is to it.

Thank you for your answer.

That is not too practical.
In that case i cannot send large file at once. I must send block,
maintain list of file objects for every client requested, etc...
That complicates code more then adding thread.

--
Predrag



More information about the Qt-interest-old mailing list