netwar.network
Class NetworkServer
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--netwar.network.NetworkServer
- All Implemented Interfaces:
- NetworkServerInterface, java.rmi.Remote, java.io.Serializable
- public class NetworkServer
- extends java.rmi.server.UnicastRemoteObject
- implements NetworkServerInterface
NetworkServer. The central server object that takes commands from players (local or remote) and broadcasts them to all players.
- Author:
- Group N2-Project Netwar, Jason Komutrattananon
- See Also:
- Serialized Form
|
Field Summary |
static NetworkServer |
server
Global Server object so server can be referenced on the local "host" machine |
| Fields inherited from class java.rmi.server.RemoteObject |
ref |
|
Constructor Summary |
NetworkServer()
Creates a new instance of NetworkServer which is binded to "Netwar Server" in the RMI Registry. |
|
Method Summary |
void |
broadcastSettings(int callingPlayer,
PlayerSettings playerSettings,
GlobalSettings globalSettings)
Sends the settings the player made to the server. |
int |
callerID(NetworkClientInterface client)
Sends the networkClientInterface to the server so the server can talk back to the client without the host user having to input the ip address of the client
RMI type: Server |
void |
setCommand(int playerNumber,
Command remotePlayersCommand)
Sends the command the player made to the server
RMI type: Server |
void |
startGame()
Sends the signal to start the game to every client. |
| 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 |
server
public static NetworkServer server
- Global Server object so server can be referenced on the local "host" machine
NetworkServer
public NetworkServer()
throws java.rmi.RemoteException
- Creates a new instance of NetworkServer which is binded to "Netwar Server" in the RMI Registry.
setCommand
public void setCommand(int playerNumber,
Command remotePlayersCommand)
throws java.rmi.RemoteException
- Sends the command the player made to the server
RMI type: Server
- Specified by:
setCommand in interface NetworkServerInterface
- Parameters:
playerNumber - The number of the player that set the command.remotePlayersCommand - The command the player made that needs to be broadcast to the server.- Throws:
java.rmi.RemoteException - In the case of not being able to connect or send data to the remote computer.
callerID
public int callerID(NetworkClientInterface client)
throws java.rmi.RemoteException
- Sends the networkClientInterface to the server so the server can talk back to the client without the host user having to input the ip address of the client
RMI type: Server
- Specified by:
callerID in interface NetworkServerInterface
- Parameters:
Client - The number of the player that set the command.- Throws:
java.rmi.RemoteException - In the case of not being able to connect or send data to the remote computer.
startGame
public void startGame()
- Sends the signal to start the game to every client.
RMI type: Client
broadcastSettings
public void broadcastSettings(int callingPlayer,
PlayerSettings playerSettings,
GlobalSettings globalSettings)
throws java.rmi.RemoteException
- Sends the settings the player made to the server.
RMI type: Server
- Specified by:
broadcastSettings in interface NetworkServerInterface
- Parameters:
callingPlayer - The number of the player that called the method.playerSettings - The player's settings that will be sent to the server.GlobalSettings - The global settings that will be sent to the server.- Throws:
java.rmi.RemoteException - In the case of not being able to connect or send data to the remote computer.