I want to stop accepting connection from the main thread .. I have copied the original code here. in this server. it spawn a new thread per each connection. there is a seperate thread to clean the connection pool and another thread for user command processing all works perfectly. i just want to stop accepting new connection based on user commands. the accept method exists within the main thread i used the following logic to stop accepting
while (bListening && (sctCommSocket = accept(sctBaseSocket,(struct sockaddr *)&addrClient,&c)) != INVALID_SOCKET)
but after setting bListening to true.. the loop still accept 1 connection.. but this was not expected. please explain