jfreerails.network
Class EchoGameServer
java.lang.Object
jfreerails.network.EchoGameServer
- All Implemented Interfaces:
- java.lang.Runnable, GameServer, GameModel
public class EchoGameServer
- extends java.lang.Object
- implements GameServer, java.lang.Runnable
Implementation of GameServer that simply echoes whatever clients send it.
- Author:
- Luke
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
private static final java.util.logging.Logger logger
connections
private final java.util.Vector<Connection2Client> connections
status
private final SynchronizedFlag status
messsages2send
private final java.util.LinkedList<FreerailsSerializable> messsages2send
EchoGameServer
private EchoGameServer()
startServer
public static EchoGameServer startServer()
- Creates an EchoGameServer, starts it in a new Thread, and waits for its
status to change to isOpen before returning.
addConnection
public void addConnection(Connection2Client connection)
- Specified by:
addConnection in interface GameServer
countOpenConnections
public int countOpenConnections()
- Specified by:
countOpenConnections in interface GameServer
stop
public void stop()
- Specified by:
stop in interface GameServer
run
public void run()
- Specified by:
run in interface java.lang.Runnable
sendMessage
void sendMessage(FreerailsSerializable m)
update
public void update()
- Specified by:
update in interface GameModel