Hi, im designing a login server for a game, and every time the server receives a connection i intend to a launch a new thread. I was playing with the code from another server i made which was only capable of connecting to one client, and basically it does this.
what i was expecting was the server thread to block at listen(), and then continue after the client tried to connect. The client, ofcourse, timed out. however, i then tried running two clients, and both of them found the server (im not sure if they both got "accepted") and then timed out.
//define the listening socket above
//define a server socket
serverSock = accept(listenSock, NULL, NULL);
//terminate server thread, as this is just a test
So what does listen() actually. Im really confused, as i was intending to make a loop using listen to block until a client tried to connect and then launch a thread. But it would appear as though listen did more than just block. Could someone please explain whats going on there. Thanks.