docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct PacketSizeStatistics

    A structure to hold statistics and counters about packet sizes. Usually this will be returned through GetStatistics().

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

    Sizes tracked in this structure include headers for IP and UDP/TCP but do not include any link-layer headers (Ethernet, Wi-Fi, etc.) as those are too dependent on the deployment environment. Similarly, the sizes do not account for any padding that could be added to meet minimum frame size requirements (e.g. 64 bytes for Ethernet).

    For WebSocket connections, the TCP header is assumed to be 32 bytes long. Furthermore even though Nagle's algorithm is disabled in Unity Transport (for non-web platforms), the nature of TCP means that the packet sizes reported here may not correspond one-to-one with sizes observed on the wire since the OS may opt to segment the traffic differently. Nevertheless, they should represent a good approximation of the shape of the traffic.

    Note that if using a custom INetworkInterface, no assumptions are made about the size of headers that could be added by the OS and the sizes reported here will be exactly what is being passed to/from the network interface.

    Properties

    Between128And255Bytes

    Number of packets recorded that were between 128 and 255 bytes.

    Declaration
    public uint Between128And255Bytes { get; }
    Property Value
    Type Description
    uint

    Between256And511Bytes

    Number of packets recorded that were between 256 and 511 bytes.

    Declaration
    public uint Between256And511Bytes { get; }
    Property Value
    Type Description
    uint

    Between512And1023Bytes

    Number of packets recorded that were between 512 and 1023 bytes.

    Declaration
    public uint Between512And1023Bytes { get; }
    Property Value
    Type Description
    uint

    LargerThan1023Bytes

    Number of packets recorded that were larger than 1023 bytes.

    Declaration
    public uint LargerThan1023Bytes { get; }
    Property Value
    Type Description
    uint

    Maximum

    Largest packet size recorded.

    Declaration
    public uint Maximum { get; }
    Property Value
    Type Description
    uint

    Mean

    Average packet size over all packets recorded.

    Declaration
    public float Mean { get; }
    Property Value
    Type Description
    float

    Minimum

    Smallest packet size recorded.

    Declaration
    public uint Minimum { get; }
    Property Value
    Type Description
    uint

    SmallerThan128Bytes

    Number of packets recorded that were smaller than 128 bytes.

    Declaration
    public uint SmallerThan128Bytes { get; }
    Property Value
    Type Description
    uint

    StandardDeviation

    Standard deviation of packet sizes over all packets recorded.

    Declaration
    public float StandardDeviation { get; }
    Property Value
    Type Description
    float
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)