|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--org.jogre.common.AbstractConnectionThread | +--org.jogre.server.ServerConnectionThread
Every time a client connections to a JogreServer this class (which extends Thread) is run. This ensures that a JogreServer is multi-thread.
JogreServer
Field Summary | |
protected ConnectionList |
connections
Convience link to the userList field in the JogreServer object. |
protected JogreServer |
server
link to the JogreServer |
protected TableList |
tableList
Convience link to the tableList field in the JogreServer object. |
protected UserList |
userList
Convience link to the userList field in the JogreServer object. |
Fields inherited from class org.jogre.common.AbstractConnectionThread |
in, loop, out, socket, username |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
ServerConnectionThread(Socket clientSocket,
JogreServer server)
Constructor which takes a socket connection and a link to the server. |
Method Summary | |
void |
broadcast(ITransmittable transmittableObject)
Broadcast a transmittable object to all the clients. |
void |
broadcast(String message)
Broadcast a message to all clients. |
void |
broadcast(String omitUser,
String message)
Broadcasts a message to all users except the person who sent the message. |
void |
cleanup()
Client has exitted so clean everything up. |
void |
parse(String messageType,
String inString)
Implementation of the parse method. |
void |
transmit(String username,
ITransmittable transObject)
Overloaded version which takes a ITransmittable object. |
void |
transmit(String username,
String message)
This little helper method sends an object to the two players in a game. |
void |
transmitToTable(int tableNum,
ITransmittable transObject)
Transmit a message to the specified table. |
void |
transmitToTable(String omitUser,
int tableNum,
ITransmittable transObject)
Transmit a messgae to a table but omit a user (this user will generally be the player who has created the message in the first place). |
Methods inherited from class org.jogre.common.AbstractConnectionThread |
getReader, getSocket, getUsername, run, send, send |
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 |
protected JogreServer server
protected UserList userList
protected TableList tableList
protected ConnectionList connections
Constructor Detail |
public ServerConnectionThread(Socket clientSocket, JogreServer server)
clientSocket
- server
- Method Detail |
public void parse(String messageType, String inString) throws TransmissionException
parse
in class AbstractConnectionThread
AbstractConnectionThread.parse(java.lang.String, java.lang.String)
public void cleanup()
cleanup
in class AbstractConnectionThread
AbstractConnectionThread.cleanup()
public void transmit(String username, String message)
username
- Username of the client.message
- Message as a String.public void transmitToTable(int tableNum, ITransmittable transObject)
tableNum
- transObject
- public void transmitToTable(String omitUser, int tableNum, ITransmittable transObject)
omitUser
- Username to omit from the list (usually the sender).tableNum
- Table number to transmit message to.transObject
- Object which implements the ITransmittable interface.public void broadcast(String message)
message
- public void broadcast(ITransmittable transmittableObject)
transmittableObject
- public void broadcast(String omitUser, String message)
omitUser
- User to omit.message
- Message as a String.public void transmit(String username, ITransmittable transObject)
username
- Username to send message to.transObject
- Transmittable object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |