Subj : Desiging a proper server model To : comp.programming.threads From : Leon Mergen Date : Sun Feb 20 2005 08:53 pm Hello, I'm currently in the process of implementing a web server. I've currently applied the Reactor pattern an Half Sync/Half Async pattern for accepting client connections and creating a thread pool. Now, I'm using the select() mechanism to determine which sockets are ready to be read/written to. When an activity occurs, all the 'active' socket handles are sent to a queue. These are picked up by a thread of a thread pool. Now, basically, this thread now has a socket file descriptor it can read from. However, nothing guarantees that this is going to be either the first or the last time it's read from (as in, not the complete message might be passed on in one go). What is The Right Way of solving this problem ? What is a good mechanism to be able to read from a socket multiple times from multiple threads, but still have all the data, in the right order, accessible so it can be parsed when everything is received ? The only solution I can think of now is to give each thread a pointer to a general 'data queue' class. This class will separate all incoming data, based on the handle, and should use mutual exclusions to prevent race conditions. I do have the feeling this isn't the correct way to do this. Anyone knows of any better solution ? Thanks in advance for any ideas. Regards, Leon Mergen .