Originally Posted by
abachler
Well, per thread works best if you dynamicalyl allocate teh socket object, then pass a pointer to that object to the thread on creation. So you have a listening thread which spawns the actual communication threads. Be aware though that thread per connection will have an effective limit of around 100 connections, after that you start spending too much time switching between threads. A socket pool is a better approach at that point, and spawn only as many communication threads as you have processors, or perhaps one less if you have several. This way the listener thread can just pu tnew connections into the pool, while the communication threads service each connection n turn.