|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectGameNetworkObject
public class GameNetworkObject
This class is used by GameServer and GameClient to send data to each other across the Internet (like a packet). This class stores a single object as well as the protocol for communication. The protocol can may specify that a data object is being sent, which would indicate what kind of data, or it may specify a message without data. This class is used as a universal network packet object. If certain games would like to add more functionality by adding their own static variables, they should simply extend the class.
| Field Summary | |
|---|---|
static int |
COLOR
Protocol message type that the server sends to clients indicating their color |
static int |
DRAW
Protocol message type that the server would send to clients to inform them that the game has ended in a draw. |
static int |
GAME_BOARD
Protocol message type that the server would use to send the current game board to clients. |
static int |
GAME_FULL
Protocol message type that the server would send to clients trying to connect to inform them that there is no room for that client to connect. |
static int |
GAME_INTERRUPTED
Protocol message type that the server would send to clients to inform them that the game has been interrupted, most likely due to one of the clients disconnecting from the server. |
static int |
GAME_RESET
Protocol message type that the server would send to clients to inform them that the game has been reset, like at the end of a completed game. |
static int |
MOVE
Protocol message type that the client would use to send a move to the server. |
static int |
PLAYER_PROFILE
|
static int |
START_GAME
Protocol message type that the server would send to all clients to let them know the game has just started. |
static int |
STATS
Protocol message type that the server sends to clients telling them the current game stats |
static int |
WINNER
Protocol message type that the server would send to all clients to inform them that the game has been won. |
static int |
YOUR_TURN
Protocol message type that the server uses to send to clients indicating whose turn it is. |
| Constructor Summary | |
|---|---|
GameNetworkObject(int initType)
Constructor to be used for network packets that will include messages, but no data. |
|
GameNetworkObject(int initType,
java.lang.Object initData)
Constructor to be used for network packets that will include both messages and data. |
|
| Method Summary | |
|---|---|
java.lang.Object |
getData()
Accessor method for the data stored by this packet. |
int |
getType()
Accessor method for the type of this packet. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int START_GAME
public static final int GAME_FULL
public static final int GAME_INTERRUPTED
public static final int DRAW
public static final int PLAYER_PROFILE
public static final int YOUR_TURN
public static final int STATS
public static final int COLOR
public static final int GAME_BOARD
public static final int MOVE
public static final int WINNER
public static final int GAME_RESET
| Constructor Detail |
|---|
public GameNetworkObject(int initType)
throws java.lang.IllegalArgumentException
initType - - the type of message represented by this object.
java.lang.IllegalArgumentException
public GameNetworkObject(int initType,
java.lang.Object initData)
throws java.lang.IllegalArgumentException
initType - - the type of message represented by this object.initData - - the data stored by this object packet.
java.lang.IllegalArgumentException| Method Detail |
|---|
public java.lang.Object getData()
public int getType()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||