All Packages Class Hierarchy This Package Previous Next Index
Class game.ServerHandler
java.lang.Object
|
+----java.lang.Thread
|
+----game.Handler
|
+----game.ServerHandler
- public class ServerHandler
- extends Handler
The ServerHandler
class handles the server connection
in the client. [DESCRIBE ME MORE]
-
address
- DNS name of the server we're dealing with (or IP address)
-
BIG_CHANGE
-
-
changeData
-
-
changeStatus
-
-
gameInfos
- Vector containing GameInfos about the games the server can provide.
-
INFO_ADDED
-
-
INFO_CHANGED
-
-
INFO_REMOVED
-
-
name
- Name of the server (retrieved from the server itself)
-
NO_CHANGE
-
-
port
- Port number of the server
-
version
- Version of the server
-
ServerHandler(Socket, String, int)
- Creates a new ServerHandler.
-
clearChanged()
-
-
countGames()
- Returns the number of games available from this server
-
doCreateGame(LinkFrame)
- Handles the ST_CREATE_GAME message.
-
doGameRemoved(LinkFrame)
- Handles the ST_GAME_REMOVED message.
-
doInfoChanged(LinkFrame)
- Handles the ST_INFO_CHANGED message.
-
frameReceived(Object, LinkFrame)
- Messaged when a new data frame is received by the
GameLink
object and this frame belongs to the groups the GameLinkListener
asked to listen to.
-
getChangeInfo()
-
-
getChangeInfos()
-
-
getChangeStatus()
- Returns the last change status of this handler.
-
getGameInfo(Object)
- Returns the
GameInfo
corresponding to the given Id.
-
getGameInfos()
- Returns all
GameInfo
available from this server.
-
getServerAddress()
- Returns the host name or IP address of the server we're connected to
-
getServerName()
- Returns the name of the server we're connected to
-
getServerPort()
- Returns the port of the server we're connected to
-
removeGameInfo(Object)
- Removes from the game infos set the
GameInfo
corresponding
to the given Id.
-
run()
- Starts this server handler.
-
setChangeData(Object)
-
-
setChangeStatus(int)
-
-
toString()
- Returns a string representation of the object.
address
String address
- DNS name of the server we're dealing with (or IP address)
name
String name
- Name of the server (retrieved from the server itself)
port
int port
- Port number of the server
version
int version
- Version of the server
gameInfos
Vector gameInfos
- Vector containing GameInfos about the games the server can provide.
changeData
Object changeData
changeStatus
int changeStatus
NO_CHANGE
public static final int NO_CHANGE
BIG_CHANGE
public static final int BIG_CHANGE
INFO_CHANGED
public static final int INFO_CHANGED
INFO_ADDED
public static final int INFO_ADDED
INFO_REMOVED
public static final int INFO_REMOVED
ServerHandler
public ServerHandler(Socket socket,
String address,
int port) throws SocketException
- Creates a new ServerHandler.
- Parameters:
- socket - the socket connected to the server.
- address - name or IP address of the server.
- port - the port the server listens to.
run
public void run()
- Starts this server handler. This methods keeps on executing until the connection
with server is lost, so it should be run in a separate thread.
- Overrides:
- run in class Thread
getServerAddress
public String getServerAddress()
- Returns the host name or IP address of the server we're connected to
getServerName
public String getServerName()
- Returns the name of the server we're connected to
getServerPort
public int getServerPort()
- Returns the port of the server we're connected to
countGames
public int countGames()
- Returns the number of games available from this server
getGameInfo
public GameInfo getGameInfo(Object id)
- Returns the
GameInfo
corresponding to the given Id.
- Parameters:
- id - the id used to search for the
GameInfo
- Returns:
- the corresponding
GameInfo
getGameInfos
public Enumeration getGameInfos()
- Returns all
GameInfo
available from this server.
removeGameInfo
public void removeGameInfo(Object id)
- Removes from the game infos set the
GameInfo
corresponding
to the given Id. In this very particular case, id may be a regular
game id OR a GameInfo object.
- Parameters:
- id - the id of the game to be removed from the client.
toString
public String toString()
- Returns a string representation of the object.
- Overrides:
- toString in class Thread
frameReceived
public void frameReceived(Object link,
LinkFrame frame)
- Messaged when a new data frame is received by the
GameLink
object and this frame belongs to the groups the GameLinkListener
asked to listen to.
- Parameters:
- frame - the frame that has just been received.
- Overrides:
- frameReceived in class Handler
- See Also:
- GameLink
doInfoChanged
public void doInfoChanged(LinkFrame frame)
- Handles the ST_INFO_CHANGED message.
- Parameters:
- frame - the frame containing the ST_INFO_CHANGED message.
doGameRemoved
public void doGameRemoved(LinkFrame frame)
- Handles the ST_GAME_REMOVED message.
- Parameters:
- frame - the frame containing the ST_GAME_REMOVED message.
doCreateGame
public void doCreateGame(LinkFrame frame)
- Handles the ST_CREATE_GAME message. Actually instantiates the client game
class and start the client game.
- Parameters:
- frame - the frame containing the ST_CREATE_GAME message.
getChangeStatus
public int getChangeStatus()
- Returns the last change status of this handler.
setChangeStatus
void setChangeStatus(int status)
clearChanged
public void clearChanged()
setChangeData
void setChangeData(Object data)
getChangeInfos
public Enumeration getChangeInfos()
getChangeInfo
public GameInfo getChangeInfo()
All Packages Class Hierarchy This Package Previous Next Index