net.sourceforge.simplegamenet.framework.transport
Class ServerModem

java.lang.Object
  extended bynet.sourceforge.simplegamenet.framework.transport.Modem
      extended bynet.sourceforge.simplegamenet.framework.transport.ServerModem
All Implemented Interfaces:
net.sourceforge.simplegamenet.framework.transport.PacketCodes

public class ServerModem
extends net.sourceforge.simplegamenet.framework.transport.Modem


Field Summary
static int CHAT_ASK_MESSAGE
           
static int CHAT_GRANT_MESSAGE
           
static int CON_ADD_PLAYER
           
static int CON_BAN
           
static int CON_CLIENT_CON_CLOSE
           
static int CON_CLIENT_CON_OPEN
           
static int CON_CLIENT_PING
           
static int CON_CLIENT_PONG
           
static int CON_KICK
           
static int CON_LOGIN_DATA
           
static int CON_LOGIN_NICKNAME
           
static int CON_REMOVE_PLAYER_BY_BAN
           
static int CON_REMOVE_PLAYER_BY_CLIENT_VIOLATION
           
static int CON_REMOVE_PLAYER_BY_DISCONNECTION
           
static int CON_REMOVE_PLAYER_BY_KICK
           
static int CON_REMOVE_PLAYER_BY_LEFT
           
static int CON_REMOVE_PLAYER_BY_SERVER_VIOLATION
           
static int CON_SERVER_CON_CLOSE
           
static int CON_SERVER_CON_OPEN
           
static int CON_SERVER_PING
           
static int CON_SERVER_PONG
           
static int CON_SGN_VERSION
           
static int E_CHAT_MESSAGE
           
static int E_CON_BANNED
           
static int E_CON_CLIENT_CON_OPEN
           
static int E_CON_CLIENT_SGN_VERSION
           
static int E_CON_CLIENT_VIOLATION
           
static int E_CON_LOGIN
           
static int E_CON_SERVER_SGN_VERSION
           
static int E_CON_SERVER_VIOLATION
           
static int E_GAME_CHANGE_GAME_SETTINGS_GAME_IN_PROGRESS
           
static int E_GAME_CHANGE_GAME_SETTINGS_NOT_ACCEPTED
           
static int E_GAME_CHANGE_PLAYER_SETTINGS_GAME_IN_PROGRESS
           
static int E_GAME_CHANGE_PLAYER_SETTINGS_NOT_ACCEPTED
           
static int E_GAME_CLIENT_ABORT_GAME
           
static int E_GAME_CLIENT_GAME_VERSION
           
static int E_GAME_CLIENT_START_GAME
           
static int E_GAME_NOT_FOUND
           
static int E_GAME_SERVER_GAME_VERSION
           
static int GAME_CHANGE_GAME_SETTINGS
           
static int GAME_CHANGE_PLAYER_SETTINGS
           
static int GAME_CLIENT_ABORT_GAME
           
static int GAME_CLIENT_CONFIRM_GAME_ABORTING
           
static int GAME_CLIENT_CONFIRM_GAME_STOPPING
           
static int GAME_CLIENT_SEND_DATA
           
static int GAME_CLIENT_START_GAME
           
static int GAME_OPEN
           
static int GAME_SERVER_GAME_ABORTING
           
static int GAME_SERVER_GAME_ENDED
           
static int GAME_SERVER_GAME_STARTED
           
static int GAME_SERVER_GAME_STOPPING
           
static int GAME_SERVER_SEND_DATA
           
static int GAME_UPDATE_GAME_SETTINGS
           
static int GAME_UPDATE_PLAYER_SETTINGS
           
protected  Integer nextPingID
           
protected  HashMap pingIDMap
           
protected  TaskQueue taskQueue
           
 
Constructor Summary
ServerModem(ServerEngineImpl serverEngine, int port)
           
 
Method Summary
 void addNewConnection(NewConnectionData newConnectionData)
           
 void addNewConnectionInEventThread(NewConnectionData newConnectionData)
           
 void banPlayer(Integer playerID)
           
 void closeServer()
           
 void closeServerInServerThread()
           
 void gameAborting()
           
 void gameEnded(Integer playerID)
           
 void gameStarted()
           
 void gameStopping()
           
 void kickPlayer(Integer playerID)
           
 void kickProtocolViolatingPlayer(Integer playerID)
           
 void processDisconnection(Integer playerID)
           
 void processDisconnectionInEventThread(Integer playerID)
           
 void processPacket(Integer playerID, Packet packet)
           
 void processPacketInServerThread(Integer playerID, Packet packet)
           
 void sendChatMessage(ChatMessage chatMessage)
           
 void sendChatMessage(Integer playerID, ChatMessage chatMessage)
           
 void sendData(Integer playerID, Serializable data)
           
 void sendData(Serializable data)
           
 void updateGameSettings(net.sourceforge.simplegamenet.specs.to.GameSettings gameSettings)
           
 void updatePlayerSettings(net.sourceforge.simplegamenet.specs.to.PlayerSettings playerSettings)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

taskQueue

protected TaskQueue taskQueue

nextPingID

protected Integer nextPingID

pingIDMap

protected HashMap pingIDMap

CON_CLIENT_CON_OPEN

public static final int CON_CLIENT_CON_OPEN
See Also:
Constant Field Values

E_CON_BANNED

public static final int E_CON_BANNED
See Also:
Constant Field Values

E_CON_CLIENT_CON_OPEN

public static final int E_CON_CLIENT_CON_OPEN
See Also:
Constant Field Values

CON_SERVER_CON_OPEN

public static final int CON_SERVER_CON_OPEN
See Also:
Constant Field Values

CON_SGN_VERSION

public static final int CON_SGN_VERSION
See Also:
Constant Field Values

E_CON_CLIENT_SGN_VERSION

public static final int E_CON_CLIENT_SGN_VERSION
See Also:
Constant Field Values

E_CON_SERVER_SGN_VERSION

public static final int E_CON_SERVER_SGN_VERSION
See Also:
Constant Field Values

GAME_OPEN

public static final int GAME_OPEN
See Also:
Constant Field Values

E_GAME_NOT_FOUND

public static final int E_GAME_NOT_FOUND
See Also:
Constant Field Values

E_GAME_CLIENT_GAME_VERSION

public static final int E_GAME_CLIENT_GAME_VERSION
See Also:
Constant Field Values

E_GAME_SERVER_GAME_VERSION

public static final int E_GAME_SERVER_GAME_VERSION
See Also:
Constant Field Values

CON_LOGIN_NICKNAME

public static final int CON_LOGIN_NICKNAME
See Also:
Constant Field Values

E_CON_LOGIN

public static final int E_CON_LOGIN
See Also:
Constant Field Values

CON_LOGIN_DATA

public static final int CON_LOGIN_DATA
See Also:
Constant Field Values

CON_CLIENT_PING

public static final int CON_CLIENT_PING
See Also:
Constant Field Values

CON_SERVER_PONG

public static final int CON_SERVER_PONG
See Also:
Constant Field Values

CON_SERVER_PING

public static final int CON_SERVER_PING
See Also:
Constant Field Values

CON_CLIENT_PONG

public static final int CON_CLIENT_PONG
See Also:
Constant Field Values

CHAT_ASK_MESSAGE

public static final int CHAT_ASK_MESSAGE
See Also:
Constant Field Values

E_CHAT_MESSAGE

public static final int E_CHAT_MESSAGE
See Also:
Constant Field Values

CHAT_GRANT_MESSAGE

public static final int CHAT_GRANT_MESSAGE
See Also:
Constant Field Values

GAME_CHANGE_GAME_SETTINGS

public static final int GAME_CHANGE_GAME_SETTINGS
See Also:
Constant Field Values

E_GAME_CHANGE_GAME_SETTINGS_GAME_IN_PROGRESS

public static final int E_GAME_CHANGE_GAME_SETTINGS_GAME_IN_PROGRESS
See Also:
Constant Field Values

E_GAME_CHANGE_GAME_SETTINGS_NOT_ACCEPTED

public static final int E_GAME_CHANGE_GAME_SETTINGS_NOT_ACCEPTED
See Also:
Constant Field Values

GAME_UPDATE_GAME_SETTINGS

public static final int GAME_UPDATE_GAME_SETTINGS
See Also:
Constant Field Values

CON_ADD_PLAYER

public static final int CON_ADD_PLAYER
See Also:
Constant Field Values

GAME_CHANGE_PLAYER_SETTINGS

public static final int GAME_CHANGE_PLAYER_SETTINGS
See Also:
Constant Field Values

E_GAME_CHANGE_PLAYER_SETTINGS_GAME_IN_PROGRESS

public static final int E_GAME_CHANGE_PLAYER_SETTINGS_GAME_IN_PROGRESS
See Also:
Constant Field Values

E_GAME_CHANGE_PLAYER_SETTINGS_NOT_ACCEPTED

public static final int E_GAME_CHANGE_PLAYER_SETTINGS_NOT_ACCEPTED
See Also:
Constant Field Values

GAME_UPDATE_PLAYER_SETTINGS

public static final int GAME_UPDATE_PLAYER_SETTINGS
See Also:
Constant Field Values

CON_CLIENT_CON_CLOSE

public static final int CON_CLIENT_CON_CLOSE
See Also:
Constant Field Values

CON_REMOVE_PLAYER_BY_LEFT

public static final int CON_REMOVE_PLAYER_BY_LEFT
See Also:
Constant Field Values

CON_KICK

public static final int CON_KICK
See Also:
Constant Field Values

CON_REMOVE_PLAYER_BY_KICK

public static final int CON_REMOVE_PLAYER_BY_KICK
See Also:
Constant Field Values

CON_BAN

public static final int CON_BAN
See Also:
Constant Field Values

CON_REMOVE_PLAYER_BY_BAN

public static final int CON_REMOVE_PLAYER_BY_BAN
See Also:
Constant Field Values

CON_REMOVE_PLAYER_BY_DISCONNECTION

public static final int CON_REMOVE_PLAYER_BY_DISCONNECTION
See Also:
Constant Field Values

E_CON_CLIENT_VIOLATION

public static final int E_CON_CLIENT_VIOLATION
See Also:
Constant Field Values

CON_REMOVE_PLAYER_BY_CLIENT_VIOLATION

public static final int CON_REMOVE_PLAYER_BY_CLIENT_VIOLATION
See Also:
Constant Field Values

E_CON_SERVER_VIOLATION

public static final int E_CON_SERVER_VIOLATION
See Also:
Constant Field Values

CON_REMOVE_PLAYER_BY_SERVER_VIOLATION

public static final int CON_REMOVE_PLAYER_BY_SERVER_VIOLATION
See Also:
Constant Field Values

CON_SERVER_CON_CLOSE

public static final int CON_SERVER_CON_CLOSE
See Also:
Constant Field Values

GAME_CLIENT_START_GAME

public static final int GAME_CLIENT_START_GAME
See Also:
Constant Field Values

E_GAME_CLIENT_START_GAME

public static final int E_GAME_CLIENT_START_GAME
See Also:
Constant Field Values

GAME_SERVER_GAME_STARTED

public static final int GAME_SERVER_GAME_STARTED
See Also:
Constant Field Values

GAME_CLIENT_SEND_DATA

public static final int GAME_CLIENT_SEND_DATA
See Also:
Constant Field Values

GAME_SERVER_SEND_DATA

public static final int GAME_SERVER_SEND_DATA
See Also:
Constant Field Values

GAME_CLIENT_ABORT_GAME

public static final int GAME_CLIENT_ABORT_GAME
See Also:
Constant Field Values

E_GAME_CLIENT_ABORT_GAME

public static final int E_GAME_CLIENT_ABORT_GAME
See Also:
Constant Field Values

GAME_SERVER_GAME_STOPPING

public static final int GAME_SERVER_GAME_STOPPING
See Also:
Constant Field Values

GAME_SERVER_GAME_ABORTING

public static final int GAME_SERVER_GAME_ABORTING
See Also:
Constant Field Values

GAME_CLIENT_CONFIRM_GAME_STOPPING

public static final int GAME_CLIENT_CONFIRM_GAME_STOPPING
See Also:
Constant Field Values

GAME_CLIENT_CONFIRM_GAME_ABORTING

public static final int GAME_CLIENT_CONFIRM_GAME_ABORTING
See Also:
Constant Field Values

GAME_SERVER_GAME_ENDED

public static final int GAME_SERVER_GAME_ENDED
See Also:
Constant Field Values
Constructor Detail

ServerModem

public ServerModem(ServerEngineImpl serverEngine,
                   int port)
            throws IOException
Method Detail

processPacketInServerThread

public void processPacketInServerThread(Integer playerID,
                                        Packet packet)

processPacket

public void processPacket(Integer playerID,
                          Packet packet)

sendChatMessage

public void sendChatMessage(Integer playerID,
                            ChatMessage chatMessage)

sendChatMessage

public void sendChatMessage(ChatMessage chatMessage)

updateGameSettings

public void updateGameSettings(net.sourceforge.simplegamenet.specs.to.GameSettings gameSettings)

addNewConnectionInEventThread

public void addNewConnectionInEventThread(NewConnectionData newConnectionData)

addNewConnection

public void addNewConnection(NewConnectionData newConnectionData)

updatePlayerSettings

public void updatePlayerSettings(net.sourceforge.simplegamenet.specs.to.PlayerSettings playerSettings)

kickPlayer

public void kickPlayer(Integer playerID)

banPlayer

public void banPlayer(Integer playerID)

kickProtocolViolatingPlayer

public void kickProtocolViolatingPlayer(Integer playerID)
                                 throws IllegalArgumentException
Throws:
IllegalArgumentException

processDisconnectionInEventThread

public void processDisconnectionInEventThread(Integer playerID)

processDisconnection

public void processDisconnection(Integer playerID)

gameStarted

public void gameStarted()

sendData

public void sendData(Integer playerID,
                     Serializable data)
              throws IllegalArgumentException
Throws:
IllegalArgumentException

sendData

public void sendData(Serializable data)

gameStopping

public void gameStopping()

gameAborting

public void gameAborting()

gameEnded

public void gameEnded(Integer playerID)
               throws ClassCastException
Throws:
ClassCastException

closeServerInServerThread

public void closeServerInServerThread()

closeServer

public void closeServer()


Copyright © 2003-2004 The 3 Belgians. All Rights Reserved.