|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
tipgame.net.Server
public class Server
This is used to receive and transmit data for consistency. The server is the authority of all information and all clients run in lock step with the server on a common clock. Upon a client connecting, the server sends:
| Nested Class Summary | |
|---|---|
(package private) class |
Server.Dispatcher
communicates with the client to determine which game to join |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
private boolean |
connected
true indicates still accepting new connections, false indicates accepting no more connections |
private java.util.HashMap<java.lang.String,GameConnections> |
games
map of currently running games to the GameConnections |
private java.io.ObjectInputStream |
pipedIn
the input stream used for applets |
private java.io.ObjectOutputStream |
pipedOut
the output stream used for applets |
static int |
PORT
port on which to run the server |
private java.net.ServerSocket |
serverSocket
the socket listening for new connections |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
Server()
|
|
Server(java.lang.Object dummy)
|
|
| Method Summary | |
|---|---|
void |
connect()
connects to a client and forwards the connections to the proper GameConnection |
void |
disconnect()
stops the loop from accepting new connections |
java.io.ObjectInputStream |
getPipedInput()
makes a piped input stream to use in applets |
java.io.ObjectOutputStream |
getPipedOutput()
makes a piped output stream to use in applets |
static void |
main(java.lang.String[] argv)
starts the server accepting new connections |
void |
run()
starts the pipes for applets, or the server for applications |
void |
startPipes()
starts pipe communications |
| 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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static int PORT
private java.util.HashMap<java.lang.String,GameConnections> games
private boolean connected
private java.io.ObjectOutputStream pipedOut
private java.io.ObjectInputStream pipedIn
private java.net.ServerSocket serverSocket
| Constructor Detail |
|---|
public Server(java.lang.Object dummy)
public Server()
| Method Detail |
|---|
public java.io.ObjectInputStream getPipedInput()
public java.io.ObjectOutputStream getPipedOutput()
public void startPipes()
public void connect()
java.lang.Exception - if an error occurs while establishing the initial connectionspublic void disconnect()
public void run()
run in interface java.lang.Runnablerun in class java.lang.ThreadRunnable.run()public static void main(java.lang.String[] argv)
argv - not used
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||