netwar.network
Class NetworkClient
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--netwar.network.NetworkClient
- All Implemented Interfaces:
- NetworkClientInterface, java.rmi.Remote, java.io.Serializable
- public class NetworkClient
- extends java.rmi.server.UnicastRemoteObject
- implements NetworkClientInterface
The Client network adapter that sends and recieves commands to and from the Netwar Server.
- Author:
- Group N2-Project Netwar, Jason Komutrattananon
- See Also:
- Serialized Form
| Fields inherited from class java.rmi.server.RemoteObject |
ref |
|
Constructor Summary |
NetworkClient(java.lang.String ipAddress)
Creates a new instance of NetworkClient |
|
Method Summary |
void |
clientBroadcastSettings(int callingPlayer,
PlayerSettings playerSettings,
GlobalSettings globalSettings)
Local method used to broadcast settings to all other players through the netwar server
RMI type: Client |
void |
clientRecieveSettings(GameSettings gameSettings)
Remote method used to recieve settings and set them locally
RMI type: Server |
void |
send()
Sends the pending local command to the server
RMI type: Client |
void |
setCompleteSetOfCommands(Command[] completeSetOfCommands)
The Netwar server will send the complete set of commands once it recieves them from every single player using this method
RMI type: Server |
void |
startGame()
Signals the local machine that the server wants to start the game. |
| Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, unexportObject |
| Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
| Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
playerNumber
public int playerNumber
- This players number.
NetworkClient
public NetworkClient(java.lang.String ipAddress)
throws java.rmi.RemoteException
- Creates a new instance of NetworkClient
- Parameters:
ipAddress - is the ipAddress of the Server
send
public void send()
- Sends the pending local command to the server
RMI type: Client
setCompleteSetOfCommands
public void setCompleteSetOfCommands(Command[] completeSetOfCommands)
throws java.rmi.RemoteException
- The Netwar server will send the complete set of commands once it recieves them from every single player using this method
RMI type: Server
- Specified by:
setCompleteSetOfCommands in interface NetworkClientInterface
- Parameters:
completeSetOfCommands - the server sends this Command array which should be the complete set of commands for 1 cycle
startGame
public void startGame()
throws java.rmi.RemoteException
- Signals the local machine that the server wants to start the game.
RMI type: Server
- Specified by:
startGame in interface NetworkClientInterface
clientBroadcastSettings
public void clientBroadcastSettings(int callingPlayer,
PlayerSettings playerSettings,
GlobalSettings globalSettings)
- Local method used to broadcast settings to all other players through the netwar server
RMI type: Client
- Parameters:
callingPlayer - is the playernumber that is calling this methodplayerSettings - is the player's settingsglobalSettings - is the settings made by player 1
clientRecieveSettings
public void clientRecieveSettings(GameSettings gameSettings)
throws java.rmi.RemoteException
- Remote method used to recieve settings and set them locally
RMI type: Server
- Specified by:
clientRecieveSettings in interface NetworkClientInterface
- Parameters:
gameSettings - is the game settings that need to be propogated to all the players