class UdpPacket extends Object
Modifier and Type | Field and Description |
---|---|
private UdpHeader |
header |
static int |
MAX_PAYLOAD |
private BinaryReader |
payload |
Constructor and Description |
---|
UdpPacket(BinaryReader ms)
Initializes a new instance of the
UdpPacket class with
information from the memory stream. |
UdpPacket(EUdpPacketType type)
Initializes a new instance of the
UdpPacket class, with
no payload. |
UdpPacket(EUdpPacketType type,
BinaryReader reader)
Initializes a new instance of the
UdpPacket class, of the
specified type containing the specified payload. |
UdpPacket(EUdpPacketType type,
BinaryReader payload,
int length)
Initializes a new instance of the
UdpPacket class, of the
specified type containing the first 'length' bytes of specified payload. |
Modifier and Type | Method and Description |
---|---|
byte[] |
getData()
Serializes the UdpPacket.
|
boolean |
isValid()
Gets a value indicating whether this instance is valid.
|
void |
setPayload(BinaryReader ms)
Sets the payload
|
void |
setPayload(BinaryReader ms,
int length)
Sets the payload.
|
public static final int MAX_PAYLOAD
private UdpHeader header
private BinaryReader payload
public UdpPacket(BinaryReader ms)
UdpPacket
class with
information from the memory stream.
Header is populated from the MemoryStreamms
- The stream containing the packet and it's payload data.public UdpPacket(EUdpPacketType type)
UdpPacket
class, with
no payload.
Header must be populated manually.type
- The type.public UdpPacket(EUdpPacketType type, BinaryReader reader)
UdpPacket
class, of the
specified type containing the specified payload.
Header must be populated manually.type
- The type.reader
- The payload.public UdpPacket(EUdpPacketType type, BinaryReader payload, int length)
UdpPacket
class, of the
specified type containing the first 'length' bytes of specified payload.
Header must be populated manually.type
- The type.payload
- The payload.length
- The length.public boolean isValid()
public void setPayload(BinaryReader ms)
ms
- The payload to copy.public void setPayload(BinaryReader ms, int length)
ms
- The payload.length
- The length.public byte[] getData()
Copyright © 2012. All Rights Reserved.