|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--fate.network.ServerConnection
Handles all networking on the server end.
Sets up a server socket to listen on a port and spawns ServerThread
objects to handle messages.
| Field Summary | |
static int |
FATE_PORT
|
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY |
| Constructor Summary | |
ServerConnection(int port,
MapPlayerInfo mapPlayerInfo)
Creates new ServerConnection |
|
| Method Summary | |
void |
addServerThread(int id,
ServerThread thread)
Adds a ServerThread to the map |
boolean |
initialize()
Initializes the server connection |
boolean |
messagesAvailable()
Returns true if there are messages in the message buffer |
java.lang.Object |
nextMessage()
Returns the next message in the buffer, or NULL is there are none. |
void |
receiveMessage(java.lang.Object msg)
Called by the communications thread to receive a message |
void |
removeServerThread(int id)
Removes a ServerThread from the map |
void |
run()
Start processing of incoming connections |
boolean |
sendMessage(int idClient,
GameMessage msg)
Sends a message to a client. |
| Methods inherited from class java.lang.Thread |
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getContextClassLoader,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
setContextClassLoader,
setDaemon,
setName,
setPriority,
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 final int FATE_PORT
| Constructor Detail |
public ServerConnection(int port,
MapPlayerInfo mapPlayerInfo)
| Method Detail |
public boolean initialize()
public void run()
public void addServerThread(int id,
ServerThread thread)
public void removeServerThread(int id)
public boolean sendMessage(int idClient,
GameMessage msg)
throws java.io.IOException
public void receiveMessage(java.lang.Object msg)
throws java.io.IOException
public boolean messagesAvailable()
public java.lang.Object nextMessage()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||