|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectGlomus.Server.Server
public class Server
The Server class listens for requests on a common port and processes them, adding players to games or creating new games entirely. Games are separate threads, and once they are ready, the Server launches them off, from which point an instance of the GameBoard class takes care of everything necessary to run a game.
The Server makes use of the common protocol shared between client and server as encapsulated by the Protocol class, refer to it for more information
Protocol,
GameBoard| Field Summary | |
|---|---|
static boolean |
DEBUGGING
A signal to all classes that make up the server, whether or not we are running in debug mode such that all messages received are printed to standard out |
static int |
DEFAULT_PORT
The Port the clients and server will agree to communicate on |
protected static int |
GAME_TIMEOUT
The amount of time (in milliseconds) to wait before starting up a pending game. |
static int |
REPLACEMENT_PORT
The Port at which the GameBoard class will look for replacement players when it needs them |
static java.net.ServerSocket |
REPLACEMENT_SOCKET
The ServerSocket on which to listen for replacement players join requests. |
static int |
TIMEOUT
The amount of time to wait (in milliseconds) before the Server raises a TimeoutException and kicks an AI player out for taking too long to take their turn |
| Constructor Summary | |
|---|---|
Server()
|
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
The main method runs in a simple loop forever, waiting for connections to the messaging port (DEFAULT_PORT) to request a new game, or to join a game. |
static void |
signalDone(java.lang.String name)
Called by a launched game to signify that it has finished its execution and is now shutting down; This causes the Server to free up the specified game name for future use by other new games |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_PORT
public static final int REPLACEMENT_PORT
public static java.net.ServerSocket REPLACEMENT_SOCKET
public static int TIMEOUT
protected static final int GAME_TIMEOUT
public static boolean DEBUGGING
| Constructor Detail |
|---|
public Server()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
public static void signalDone(java.lang.String name)
name - The name of the game to finalize
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||