Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 May 2012
Offline Last Active Jun 05 2016 10:58 AM

Posts I've Made

In Topic: Logic for handle multiple clients in my TCP server written in java

05 May 2012 - 04:27 PM

You should be using, last I recall, the NIO sockets.

thank you very much, didn't know about this!

First of all, Transformice is not an MMO, (each game has a very low number of players so you don't need to deal with MMO scale networking for this type of game).

What you should do is have one master server for the "lobby" and then run multiple game servers, They can but doesn't have to be on the same machine but needs different ports and should be handled by their own instance of the server application.

Have the master server keep track of how many instances of the game server each node is running and launch new ones as needed on the least busy node, (You can have game servers report their nodes status to the master server for this purpose)

For the game servers 1 or 2 threads are enough, (having one thread that only waits for new connections and one that runs the game can simplify things slightly)

I'm not sure if I understand your post. Do you mean that rather than spawning a new thread per client connected, I run some kind of game server node for handle the new client connected ? Or do you mean these game server nodes should be able to handle more than one client ? Because that is what really I was wondering. I can't figure out a way for handling multiple clients without spawning a new thread for each connection.
Maybe I'm a little bad for these things Posted Image also thank you very much for your answer too!