public class CheckersHost extends Host
Constructor | Description |
---|---|
CheckersHost(int port,
java.lang.String username) |
Create a host listening on the specified port, and start the message processing thread.
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
clientConnected(int playerID) |
Called when a new player is connected.
|
protected void |
clientDisconnected(int playerID) |
Called when a player disconnects.
|
protected void |
messageReceived(int playerID,
java.lang.Object message) |
Responds when a message is received from a client.
|
extraHandshake, getAutoreset, getClientList, resetOutput, restartServer, sendToAll, sendToOne, setAutoreset, shudownHost, shutdownServerSocket
public CheckersHost(int port, java.lang.String username) throws java.io.IOException
port
- The port to listen onjava.io.IOException
- if it is not possible to create a listening socket on the specified portprotected void messageReceived(int playerID, java.lang.Object message)
messageReceived
in class Host
playerID
- message
- The actual message that was sentprotected void clientConnected(int playerID)
clientConnected
in class Host
playerID
- The ID of the newly connected playerprotected void clientDisconnected(int playerID)
clientDisconnected
in class Host
playerID
- The ID of the disconnected player.