Quote Originally Posted by wysota
Basicaly, it's not good to use a separate thread for each connection if you expect to receive many connections at a time (nobody wants to have 100 threads of the same process in their system). On the other hand, if you expect not more than few connections at a time, it's not worth using threads because you can safely handle all the connections from within one thread (for example using the select() call or Qt sockets).
Ok, but if use threads, don't I obtain a speed-up of my process? I lose memory but I increase my speed ,no? So I suppose I have to choose the structure of the program depending on what is the priority for me,right?
Moreover, are there some *quantitative* parameters that tell me how much speed I lose depending on how many task I run in a thread?I mean: how to understand when is better to start using threads (as a function of my needs).
Hrmm , I hope the last paragraph is comprehensible...

Quote Originally Posted by wysota
Threads are good if you want to separate connections from each other, so that they don't interfere each other. On multiprocessor systems having multiple threads is the way to go. Otherwise, either use a single thread for all connections or make a hybrid system with thread queues (like apache does, for example).
Threads are also necessary to achive a real time connections between different users (like MUDs for examples), right?

Thanks!