This is my basic set up as of right now for how my server will handle new connections to a listening socket. I created a simple console app to mimic a connecting client so I can do some testing. All works fine, and I can connect, but I debugged my server(the section of code below) assuming that once my client connected, I would break out of the nested while loop so that I can do some more work before I start listening again, but It does not. Is this setup not the practical way to accomplish this?
Thanks!
Edit: _clientHook is my listening socket.
void NetworkManager::RunClientHook()
{
SOCKET newConnection;
//todo: pass off new connections to another worker thread
while(true)
{
newConnection = SOCKET_ERROR;
while(newConnection == SOCKET_ERROR)
{
newConnection = accept(_clientHook, 0, 0);
}
//pass recently connected client to a new thread
//then continue accepting new clients
}
}