|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cluedo.CluedoPDU
Information exchange between clients and server is carried out by
transmitting instances of this class via TCP. E.g. if a client wants
to get a list of all available sessions from the server it creates an
instance of SessionListRequestinfo. Instead of transmitting the info
object directly to the server it is "wrapped" into an instance of
CluedoPDU. The PDU is transmitted to the server. Beside from the
Info object the PDU contains two more fields: The field
senderId
(see
PlayerAddRequestInfo
)
itdentifies the sending client. The priority
informs
about the level of importance of the transported information. The
protocol design of the interactive Cluedo game supports two
priotrity levels (0 and 1). Packets of priority 0 must be transmitted.
Packets of priority 1 are transmitted only if the packet queue of the
sender is below a certain level, i.e. does not contain more than 10
packets to be transmitted.
Design goal: The distinction between PDU and Info objects allows us to design the communication between client and server independent from the transport protocol. Info objects can be interpreted as the "language" talked by client and server while PDU objects can be interpreted as the way of communication. This way it is possible to change the transport protocol without modifying the program logic of the application.
CluedoPDU
, Serialized FormField Summary | |
protected CluedoInfo |
cluedoInfo
The intrinsic information that is to be transported between client and server. |
protected int |
priority
The priority of the PDU. |
protected int |
senderId
Who sends this PDU? The senderid is the same unique id used by many inheritors of CluedoInfo to identify a certain player (playerId). |
protected int |
version
|
static int |
VERSION
|
Constructor Summary | |
CluedoPDU(int senderId,
CluedoInfo cluedoInfo)
This constructor sets the priority to zero (0) |
|
CluedoPDU(int senderId,
int priority,
CluedoInfo cluedoInfo)
|
Method Summary | |
CluedoInfo |
getCluedoInfo()
Get the cluedoInfo object. |
int |
getPriority()
Get the priority . |
int |
getSenderId()
Get the senderId . |
int |
getVersion()
Get the version . |
void |
setCluedoInfo(CluedoInfo cluedoInfo)
Get the cluedoInfo object. |
void |
setPriority(int priority)
Set the priority . |
void |
setSenderId(int senderId)
Set the senderId . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int VERSION
protected int version
protected int senderId
PlayerAddRequestInfo
).protected int priority
cluedoInfo
)protected CluedoInfo cluedoInfo
Constructor Detail |
public CluedoPDU(int senderId, CluedoInfo cluedoInfo)
public CluedoPDU(int senderId, int priority, CluedoInfo cluedoInfo)
Method Detail |
public int getSenderId()
senderId
.public void setSenderId(int senderId)
senderId
.public int getPriority()
priority
.public void setPriority(int priority)
priority
.public CluedoInfo getCluedoInfo()
cluedoInfo
object.public void setCluedoInfo(CluedoInfo cluedoInfo)
cluedoInfo
object.public int getVersion()
version
.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |