PDA

View Full Version : 500 clients support



yxc154
10th March 2006, 22:51
From previous threads, maybe for Qt3:
"For 500 clients I would rather use threads and QSocketDevice.
QSocket can get quite slow at this load. "

Is it still true for QTcpSocket in Qt4?

wysota
12th March 2006, 14:35
Yes. This is because of the fact that with regular use QTcpSocket handles all connections in a single thread, meaning that it handles one connection at a time. Until a request is fully handled, no other request can be processed (and also all GUI events are handled by the same thread, meaning that network and GUI operations slow each other down). But you can use QTcpSocket in multiple threads. This way more that one client can be handled simoultaneously (in the meaning that for example waiting for data coming from a disk drive doesn't prevent other clients from being handled) and GUI events don't interfere that.

yxc154
12th March 2006, 23:34
thanks,

Is examples/network/threadedfortuneserver the example for your suggestion?

wysota
13th March 2006, 09:18
It's fine. But you'll probably have to implement a more complicated thread model (for example storing threads in a queue) if you want the server to be really efficient.