TTTO.MasterServer
Class MasterServer.ClientHandler
java.lang.Object
TTTO.MasterServer.MasterServer.ClientHandler
- All Implemented Interfaces:
- java.lang.Runnable
- Enclosing class:
- MasterServer
public class MasterServer.ClientHandler
- extends java.lang.Object
- implements java.lang.Runnable
Field Summary |
private boolean |
alive
|
private Room |
hostingRoom
|
private java.io.BufferedReader |
in
|
private java.io.PrintWriter |
out
|
private java.net.Socket |
socket
|
Method Summary |
void |
kill()
Kills the client |
private void |
readMessage(java.lang.String aInData)
Checks what to do with data received from the user |
void |
run()
|
private void |
sendGameRoomListToSocket()
Sends all registered game rooms to the given ip and port |
private void |
sendMessage(java.lang.String aCommand,
java.lang.String[] aData)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
socket
private java.net.Socket socket
alive
private boolean alive
in
private java.io.BufferedReader in
out
private java.io.PrintWriter out
hostingRoom
private Room hostingRoom
MasterServer.ClientHandler
public MasterServer.ClientHandler(java.net.Socket aSocket)
- Listens for network data from a client.
Should be added to a ThreadPool
- Parameters:
aMasterServer
- The masterserver that created this clienthandleraSocket
- socket to the client/user
readMessage
private void readMessage(java.lang.String aInData)
- Checks what to do with data received from the user
- Parameters:
aInData
-
sendGameRoomListToSocket
private void sendGameRoomListToSocket()
- Sends all registered game rooms to the given ip and port
- Parameters:
aToAddress
- the ip of the useraToPort
- the port of the user
sendMessage
private void sendMessage(java.lang.String aCommand,
java.lang.String[] aData)
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
kill
public void kill()
- Kills the client