I just have a quick question regarding threads and servers and a multi-threaded server app. which I am working on. Just looking for some advice from those more experienced than I with network stuff.
I have a server (TCP) running with a single 'network event loop' running within the main process. When a new client connects, the server creates a new thread to service that connection etc. The main process will then send 'messages' to these individual threads as and when appropriate as data is received etc.
My question regards whether my following 'plan' is sound or not?
My intention is to proceed as follows : when a client makes a request to the server; the server sends the client's thread a message to tell it to read some data from the network connection and to process the request etc. This of course means that multiple threads could be engaged within the business of reading data from different clients simultaneously, and I am unsure if this is a good idea or not?
The alternative of course is for the main process to retrieve all the data first from the network connection and to then send that to the client thread? This way, only the main process undertakes the task of reading data streams from the network connection etc.
My preference at this stage is for the first option of having the individual client threads read from the various data streams. I am just unsure how the network lib will hold up to this kind of multi-threaded abuse though?
Any and all advice gratefully received.
Thanks.



