docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct PacketProcessor

    An API representing a packet acquired from a PacketsQueue, and which allows modifying the packet. The packet is represented as a slice inside a fixed-size buffer, which is why APIs like BytesAvailableAtEnd are offered.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.Networking.Transport
    Assembly: solution.dll
    Syntax
    public struct PacketProcessor

    Properties

    Name Description
    BytesAvailableAtEnd

    Bytes available in the buffer after the end of the packet.

    BytesAvailableAtStart

    Bytes available in the buffer before the start of the packet.

    Capacity

    Size of the buffer containing the packet.

    EndpointRef

    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.

    IsCreated

    Whether the packet processor was obtained from a valid PacketsQueue.

    Length

    Size of the packet's data inside the buffer.

    Offset

    Offset of the packet's first byte inside the buffer.

    Methods

    Name Description
    AppendToPayload(void*, int)

    Copy the provided bytes at the end of the packet and increases its size accordingly.

    AppendToPayload(PacketProcessor)

    Append the content of the given packet at the end of this one.

    AppendToPayload<T>(T)

    Copy the provided value at the end of the packet and increase its size accordingly.

    CopyPayload(void*, int)

    Fill the provided buffer with the data at the start of the payload. The copied data will remain in the packet (compare to RemoveFromPayloadStart(void*, int) which removes the data from the packet).

    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.

    GetPayloadDataRef<T>(int)

    Get a reference to the payload data reinterpreted to the type T.

    GetUnsafePayloadPtr()

    Get a raw pointer to the packet data.

    PrependToPayload<T>(T)

    Copy the provided value at the start of the packet and increase its size accordingly.

    RemoveFromPayloadStart(void*, int)

    Fill the provided buffer with the data at the start of the payload, and remove that data from the packet, decreasing its size accordingly.

    RemoveFromPayloadStart<T>()

    Get and remove data at the start of the payload reinterpreted to the type T.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023