vooga.network.ingame
Class VoogaGameClient

java.lang.Object
  extended by vooga.network.VoogaClient
      extended by vooga.network.ingame.VoogaGameClient
All Implemented Interfaces:
java.lang.Runnable

public class VoogaGameClient
extends VoogaClient

VoogaGameSessionClient handles online game sessions for clients. This can be used to send/receive actions, create/join game sessions, etc.

Author:
sam1, tws10, tgr3

Constructor Summary
VoogaGameClient(java.lang.String username, long gameSessionID)
           
 
Method Summary
 void connect(java.net.InetAddress host)
          Connects to the server at the specified address.
protected  void initializeConnection()
          Performs any necessary set-up for a new connection.
 void run()
          Background thread runs this and outputs messages from server as they are received.
 void sendObject(java.io.Serializable obj)
          Sends an Object to the server.
 void setObjectReceiver(INetworkObjectReceiver receiver)
           
 
Methods inherited from class vooga.network.VoogaClient
allowConnection, blockConnection, connect, connect, disconnect, getMyInputStream, getMyName, getMyOutputStream, getMySocket, isConnected, setConnected, setMyName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VoogaGameClient

public VoogaGameClient(java.lang.String username,
                       long gameSessionID)
Method Detail

setObjectReceiver

public void setObjectReceiver(INetworkObjectReceiver receiver)

run

public void run()
Background thread runs this and outputs messages from server as they are received.


sendObject

public void sendObject(java.io.Serializable obj)
                throws java.io.IOException
Sends an Object to the server. This object will be sent to all other users in the game session, which will cause the receiveObject method to be invoked on the other user's game clients.

Parameters:
obj -
Throws:
java.io.IOException

connect

public void connect(java.net.InetAddress host)
             throws java.io.IOException
Description copied from class: VoogaClient
Connects to the server at the specified address. The implementation of this method in each of the client subclasses should call the connect method with the given host and the port number specific to that client.

Specified by:
connect in class VoogaClient
Parameters:
host - The IP of an existing VoogaChatServer.
Throws:
java.io.IOException

initializeConnection

protected void initializeConnection()
Description copied from class: VoogaClient
Performs any necessary set-up for a new connection.

Specified by:
initializeConnection in class VoogaClient