|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
GameServer
OthelloServer
public class OthelloServer
This static side of this class is the Server side Application for a client/server Othello Game. Objects of this class are also used to communicate to individual threads via multithreading.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
OthelloServer(java.net.Socket initConnection,
int initPlayerNumber)
This constructor initializes the server by setting up all Object I/O to be used to communicate back and forth with this client. |
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
This starts execution of the TicTacToeServer application by running the server and listening for connecting clients. |
void |
modifyScore()
Compares the winner of the game with the playerNumber. |
void |
restartGame()
This method restarts a game either after a draw or after a player has won. |
void |
run()
This method listens for communications from the client handled by this thread and provides an adequate response such that the game progresses. |
| Methods inherited from class GameServer |
|---|
assignColors, createProfile, findOpponent, getBoardReference, getOpponent, getPlayerNumber, login, resetStats, saveProfile, selectGame, sendNetworkObject, setBoardReference, setColor, setOpponent, setPlayerNumber |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public OthelloServer(java.net.Socket initConnection,
int initPlayerNumber)
initConnection - - socket that is connected to a clientinitPlayerNumber - - represents the player number for the
client that will be communicated with by this thread.| Method Detail |
|---|
public void restartGame()
restartGame in class GameServerpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void modifyScore()
modifyScore in class GameServerwinner - - the player that won the gamepublic static void main(java.lang.String[] args)
args - - command line arguments, not used in this application
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||