This class provides a way to encapsulate and transmit data across a network. It contains methods for reading and writing data, as well as properties for accessing metadata about the packet. See more info about Platform Solutions here.
Properties
UInt64 SenderID[Get]
Gets the sender ID of the packet. This value identifies the source of the packet and can be used to track the origin of the data.
ulong Size[Get]
Gets the size of the packet in bytes. This value represents the total amount of data contained within the packet.
Member Functions
Packet
( IntPtr packetHandle )
Initializes a new instance of the Packet class with a specified packet handle. The param packetHandle must be a valid handle to a packet created by the underlying native API.
ulong ReadBytes
( byte [] destination )
Copies all the bytes in the payload into a byte array. This method is used to retrieve the raw data contained within the packet.
Parameters
destination
The destination byte array. This array must be large enough to hold the entire packet payload, which is specified by the Size property.
Returns
The number of bytes read from the packet. This value will always be equal to the Size property.
void Dispose ( )
This method is called when the Packet is being garbage collected or when it is explicitly disposed of. It is responsible for releasing any unmanaged resources, such as the native packet handle, that are held by the Packet.