Struct PacketProcessor
An API representing a packet acquired from a Packets
Inherited Members
Namespace: Unity.Networking.Transport
Assembly: solution.dll
Syntax
public struct PacketProcessor
Properties
Name | Description |
---|---|
Bytes |
Bytes available in the buffer after the end of the packet. |
Bytes |
Bytes available in the buffer before the start of the packet. |
Capacity | Size of the buffer containing the packet. |
Endpoint |
A reference to the endpoint of the packet. For packets in the receive queue, this is the endpoint from which the packet was received. For packets in the send queue, this is the endpoint the packet is destined to. This must be set appropriately for newly-enqueued packets. |
Is |
Whether the packet processor was obtained from a valid Packets |
Length | Size of the packet's data inside the buffer. |
Offset | Offset of the packet's first byte inside the buffer. |
Methods
Name | Description |
---|---|
Append |
Copy the provided bytes at the end of the packet and increases its size accordingly. |
Append |
Append the content of the given packet at the end of this one. |
Append |
Copy the provided value at the end of the packet and increase its size accordingly. |
Copy |
Fill the provided buffer with the data at the start of the payload. The copied data
will remain in the packet (compare to Remove |
Drop() | Drop the packet from its queue by setting its length to 0. Packets with a length of 0 are considered to be dropped from the queue and will be batch-recycled at the end of the update cycle. This is more performant than properly releasing packets one at a time. |
Get |
Get a reference to the payload data reinterpreted to the type T. |
Get |
Get a raw pointer to the packet data. |
Prepend |
Copy the provided value at the start of the packet and increase its size accordingly. |
Remove |
Fill the provided buffer with the data at the start of the payload, and remove that data from the packet, decreasing its size accordingly. |
Remove |
Get and remove data at the start of the payload reinterpreted to the type T. |