Socket Server, Accepting multiple Clients

I have created a simple Server and Client.
What I've done is use SDL as sort of a game.
When the server is started and the client connects, only then is the client able to play the game (which is basically just moving around an image).
If the server is not started, the client cannot play the game.
Therefore, I know the server works properly.

This works perfectly, however, if I start the server, and connect the client, it works! But if I connect ANOTHER client, the new opened app fails to connect, and closes.
When a client connects to the server, it counts the amount of players ("A new player joined!").
When the first client joins, the server states that "Player: 1 has joined". And the client can play. But when the second client joins, it says "Player: 2 has joined".
But player 2 cannot play...?

This tells me it connects properly, but is not accepted properly.

How can I accept more than one client per server?
For MMO gameplay.
You're gonna need multiple threads to handle multiple connections. Generally you have one thread that just sits there and listens on the accepting socket, and once it sees a request come in it hands off to a new thread working a socket with a random port number above 1023.

Alternatively, you could use UDP and have clients pass in data whenever they do something, have the server update and send out the updated parts of the world to all currently playing connections (have a table that stores active players).
I understand where you're going with this,
And it does make more sense.

But do you know how to do this?
I've looked at tutorials on multi-threading, but I'm having troubles understanding it or the functions within it.

But I'm more of a... Visual person.
Therefore, would you mind giving an example of this function/use?
I know it's a bit over-needy, so I don't mind a simple term at all.
Any help is greatly appreciated
Topic archived. No new replies allowed.