|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmcast.MCastPacket
mcast.TOMCastPacket
public class TOMCastPacket
An TOMMCastPacket is a:
|-------------------------------------------------------------------| | clock | user payload | | (header) | | |-------------------------------------------------------------------|The clock is 4 bytes. A TOMCastPacket expects to be the payload of an MCastPacket. In fact, it contains an MCastPacket that it uses to send/receive itself.
Field Summary | |
---|---|
private static int |
HEADER_SIZE
|
Fields inherited from class mcast.MCastPacket |
---|
buf, CLIENT_CLIENT_GOODBYE, CLIENT_MCAST, CLIENT_SERVER_HELLO, MAX_PACKET_SIZE, MAX_PAYLOAD_SIZE, SERVER_CLIENT_HELLO, SOCKET_CLOSED |
Constructor Summary | |
---|---|
TOMCastPacket()
Constructor for outgoing packets: creates packet with TOMCast header, but no payload. |
|
TOMCastPacket(MCastPacket pkt)
Constructor for incoming packets: takes an MCastPacket received off the network and views it as a TOMCastPacket. |
Method Summary | |
---|---|
int |
getClock()
|
byte[] |
getPayload()
Returns the payload - everything past the MCastPacket header. |
int |
getPayloadLength()
Returns the number of bytes in the packet past the MCastPacket header. |
void |
setClock(int clock)
Sets the TOMCastPacket header clock field. |
void |
setPayload(byte[] payload)
Sets the payload: the packet bytes past the TOMCastPacket header. |
protected void |
setPayloadLength(int len)
Direct manipulation of the payload length. |
java.lang.String |
toString()
The obligatory toString. |
Methods inherited from class mcast.MCastPacket |
---|
getAddress, getBuf, getDGPacket, getType, setAddress, setType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int HEADER_SIZE
Constructor Detail |
---|
public TOMCastPacket()
public TOMCastPacket(MCastPacket pkt)
Method Detail |
---|
public void setClock(int clock)
clock
- The value to be put in the header.public int getClock()
public void setPayload(byte[] payload)
setPayload
in class MCastPacket
payload
- The data to be put in the payload field.protected void setPayloadLength(int len)
setPayloadLength
in class MCastPacket
len
- payload length (excludes header)public byte[] getPayload()
MCastPacket
getPayload
in class MCastPacket
public int getPayloadLength()
MCastPacket
getPayloadLength
in class MCastPacket
public java.lang.String toString()
toString
in class MCastPacket
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |