java.lang.Object | +----ServM
ServM -listen to the determinate port. -handle the user list: (nick , Human(nick,Socket,comment)) -is used to broadcast messages to users. when a connection occure ServM pass the socket to SocketHub. - SocketHub(Socket) get the stream from the socket, verify the nick of the incoming user. When evrything is OK it add the user to ServM's user list with Human(nick,Socket,comment) and create a new Mstream(nick) - Human(nick,Socket,comment) read and write in the Socket have some usefull method such as isAlive() - Mstream(nick) Mstream is the "waiting room" on the server for the users. It takes the control of this user, then handle the data streams between users until he starts a game. with Game(opponent,nick) - Game(opponent,nick) Take the control of the 2 players: Player(nick,Human,move) and manage the game using MRules(nick1). When the game end it gives the two users back to Mstream. - Player(nick,Human,move) is an extension of Human, with some more method for Game() it handle if it's his Turn to play ... - MRules(nick) (note that MRules is also used by the client) It handle the game board and the rules. -This is opensource software.
static Hashtable users
static Hashtable games
static Hashtable bots
int mainPort
ServerSocket MSocket
Thread server
public ServM(int port)
public static void main(String args[])
public void run()
static void bdS(String msg)
static void bdM(String msg)
static void bdU(String key)
static void rehash()
static void createBots()
static void log(String msg)
static void die()