Original Post
I'm writing a console(no ui, no input other than the network) multi-client server in C using Winsock 2.0. It isn't a game server, it's used to process information sent to it. I'm quite new to programming and thinking in networking terms. I'd like a guide to server program flow. Similar to the way a game typically has a game loop, I'd like to know what paradigms are used for making servers in general. I'd also like to know how I'm supposed to let the server know it's supposed to terminate. Currently it either runs through its test and terminates or it runs until I kill the process in Task Manager. Its execution looks like this at the moment. Initialize some stuff. Printf some info. Process-while (any active client exists) {} Check incoming and outgoing buffers. Update active client list if incoming buffer has been filled at all. Send out anything in the output buffer. reorganize memory sleep so it doesn't take up 100% cpu time repeat, back to Process. For starters do I need to start a thread where the server listens for connections? The processing of each client is handled in one thread currently, what factors are there to determine if each client needs a separate thread? I can quite easily monitor how much processing has been done but I know thread switching is quite easy for modern computers but it is possilble for one client to change part of the data that all clients use.