thegame.client
Class GameClientConnection

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--thegame.shared.GameConnection
              |
              +--thegame.client.GameClientConnection
All Implemented Interfaces:
GameConnectionConstants, java.lang.Runnable

public class GameClientConnection
extends GameConnection

The connection to GameServer on the GameClient side.

Version:
0.99 (2000/08/28)
Author:
Erki Suurjaak

Field Summary
protected  GameClient gameClient
          The GameClient that gets the received messages.
 
Fields inherited from class thegame.shared.GameConnection
in, isRunning, out, socket
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface thegame.shared.GameConnectionConstants
DEFAULT_SERVER_PORT, DELIMITER, P2P_MOVE_MADE_MESSAGE, P2P_NEW_GAME_ACCEPTED_MESSAGE, P2P_NEW_GAME_REFUSED_MESSAGE, P2P_NEW_GAME_REQUESTED_MESSAGE, P2P_PLAYER_SURRENDERED_MESSAGE, P2P_TEXT_MESSAGE, P2P_WINNING_MOVE_MADE_MESSAGE, P2S_CREATE_GAME_MESSAGE, P2S_JOIN_GAME_MESSAGE, P2S_PLAYER_NAME_MESSAGE, P2S_PLAYER_QUIT_MESSAGE, P2S_PLAYER_RETURNED_TO_START_SCREEN_MESSAGE, P2S_PLAYER_WAITED_FOR_NEW_PLAYER_MESSAGE, P2S_READY_FOR_PLAYER_LIST_MESSAGE, PLAYER_TO_SYSTEM_MESSAGES, S2P_JOIN_GAME_FAILED_MESSAGE, S2P_JOIN_GAME_SUCCEEDED_MESSAGE, S2P_PLAYER_DROPPED_MESSAGE, S2P_PLAYER_JOINED_MESSAGE, S2P_PLAYER_LIST_MESSAGE, S2P_PLAYER_NAME_NOT_OK_MESSAGE, S2P_PLAYER_NAME_OK_MESSAGE, S2P_PLAYER_QUIT_MESSAGE, S2P_PLAYER_RETURNED_TO_START_SCREEN_MESSAGE, S2P_SERVER_SHUTDOWN_MESSAGE, SHUTDOWN_MESSAGE
 
Constructor Summary
GameClientConnection(java.net.Socket socket, GameClient gameClient)
          Constructs a GameClientConnection on the specified socket and binds it to the specified GameClient.
 
Method Summary
 void run()
           
 
Methods inherited from class thegame.shared.GameConnection
close, getMessageBody, getMessageContentsAs1DIntArray, getMessageContentsAs1DStringArray, getMessageContentsAs2DIntArray, getMessageContentsAsBoolean, getMessageID, getReadyToSendForm, send, send, send, send, send, send, setRunning
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

gameClient

protected GameClient gameClient
The GameClient that gets the received messages.
Constructor Detail

GameClientConnection

public GameClientConnection(java.net.Socket socket,
                            GameClient gameClient)
                     throws java.io.IOException
Constructs a GameClientConnection on the specified socket and binds it to the specified GameClient. Also starts the thread.
Parameters:
socket - the socket to be used
gameClient - the GameClient the GameClientConnection sends messages to
Throws:
java.io.IOException - if an I/O error occurs when constructing the superclass
Method Detail

run

public void run()
Overrides:
run in class java.lang.Thread