Packet
Namespace: DataFlow
Provides functionality for converting packets to bytes and vice versa.
public sealed class Packet
Fields
Size
The maximum size of a packet.
public static uint Size;
Constructors
Packet(Byte[])
Initializes a new packet using the provided buffer.
public Packet(Byte[] buffer)
Parameters
buffer
Byte[]
The packet raw buffer.
Packet(UInt16, BinaryWriter&)
Initializes a new empty packet using the provided identifier.
public Packet(ushort identifier, BinaryWriter& binaryWriter)
Parameters
identifier
UInt16
The packet identifier.
binaryWriter
BinaryWriter&
The packet binary writer.
Methods
Serialize()
Serializes the packet into an array of bytes suitable for transmission.
public Byte[] Serialize()
Returns
Byte[]
The packet as a byte array.
Deserialize()
Deserializes the packet from the raw state.
public BinaryReader Deserialize()
Returns
BinaryReader
The packet binary reader.
ReadIdentifier()
Reads the packet identifier.
public ushort ReadIdentifier()
Returns
UInt16
The packet identifier.