docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct RelayServerData

    Connection information about the relay server.

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

    Constructors

    RelayServerData(string, ushort, byte[], byte[], byte[], byte[], bool)

    Create a new Relay server data structure.

    Declaration
    public RelayServerData(string host, ushort port, byte[] allocationId, byte[] connectionData, byte[] hostConnectionData, byte[] key, bool isSecure)
    Parameters
    Type Name Description
    string host

    IP address or hostname of the Relay server.

    ushort port

    Port of the Relay server.

    byte[] allocationId

    ID of the Relay allocation.

    byte[] connectionData

    Connection data of the allocation.

    byte[] hostConnectionData

    Connection data of the host (same as previous for hosts).

    byte[] key

    HMAC signature of the allocation.

    bool isSecure

    Whether the Relay connection is to be secured or not.

    Remarks

    If a hostname is provided as the "host" parameter, this constructor will perform a DNS resolution to map it to an IP address. If the hostname is not in the OS cache, this operation can possibly block for a long time (between 20 and 120 milliseconds). If this is a concern, perform the DNS resolution asynchronously and pass in the resulting IP address directly (for example with System.Net.Dns.GetHostEntryAsync").

    RelayServerData(string, ushort, byte[], byte[], byte[], byte[], bool, bool)

    Create a new Relay server data structure.

    Declaration
    public RelayServerData(string host, ushort port, byte[] allocationId, byte[] connectionData, byte[] hostConnectionData, byte[] key, bool isSecure, bool isWebSocket)
    Parameters
    Type Name Description
    string host

    IP address or hostname of the Relay server.

    ushort port

    Port of the Relay server.

    byte[] allocationId

    ID of the Relay allocation.

    byte[] connectionData

    Connection data of the allocation.

    byte[] hostConnectionData

    Connection data of the host (same as previous for hosts).

    byte[] key

    HMAC signature of the allocation.

    bool isSecure

    Whether the Relay connection is to be secured or not.

    bool isWebSocket

    Whether the Relay connection is using WebSockets or not.

    Remarks

    If a hostname is provided as the "host" parameter, this constructor will perform a DNS resolution to map it to an IP address. If the hostname is not in the OS cache, this operation can possibly block for a long time (between 20 and 120 milliseconds). If this is a concern, perform the DNS resolution asynchronously and pass in the resulting IP address directly (for example with System.Net.Dns.GetHostEntryAsync").

    RelayServerData(ref NetworkEndpoint, ushort, ref RelayAllocationId, ref RelayConnectionData, ref RelayConnectionData, ref RelayHMACKey, bool)

    Declaration
    public RelayServerData(ref NetworkEndpoint endpoint, ushort nonce, ref RelayAllocationId allocationId, ref RelayConnectionData connectionData, ref RelayConnectionData hostConnectionData, ref RelayHMACKey key, bool isSecure)
    Parameters
    Type Name Description
    NetworkEndpoint endpoint
    ushort nonce
    RelayAllocationId allocationId
    RelayConnectionData connectionData
    RelayConnectionData hostConnectionData
    RelayHMACKey key
    bool isSecure

    RelayServerData(ref NetworkEndpoint, ushort, ref RelayAllocationId, ref RelayConnectionData, ref RelayConnectionData, ref RelayHMACKey, bool, bool)

    Create a new Relay server data structure (low-level constructor).

    Declaration
    public RelayServerData(ref NetworkEndpoint endpoint, ushort nonce, ref RelayAllocationId allocationId, ref RelayConnectionData connectionData, ref RelayConnectionData hostConnectionData, ref RelayHMACKey key, bool isSecure, bool isWebSocket)
    Parameters
    Type Name Description
    NetworkEndpoint endpoint

    Endpoint of the Relay server.

    ushort nonce

    Nonce used in connection handshake (preferably random).

    RelayAllocationId allocationId

    ID of the Relay allocation.

    RelayConnectionData connectionData

    Connection data of the allocation.

    RelayConnectionData hostConnectionData

    Connection data of the host (use default for hosts).

    RelayHMACKey key

    HMAC signature of the allocation.

    bool isSecure

    Whether the Relay connection is to be secured or not.

    bool isWebSocket

    Whether the Relay connection is using WebSockets or not.

    Fields

    AllocationId

    Allocation ID for the server connection.

    Declaration
    public RelayAllocationId AllocationId
    Field Value
    Type Description
    RelayAllocationId

    Allocation ID.

    ConnectionData

    Connection data of the allocation.

    Declaration
    public RelayConnectionData ConnectionData
    Field Value
    Type Description
    RelayConnectionData

    Connection data structure.

    Endpoint

    Endpoint the relay server can be reached on.

    Declaration
    public NetworkEndpoint Endpoint
    Field Value
    Type Description
    NetworkEndpoint

    Server endpoint (IP address and port).

    HMACKey

    HMAC key used to authentify the connection.

    Declaration
    public RelayHMACKey HMACKey
    Field Value
    Type Description
    RelayHMACKey

    HMAC key.

    HostConnectionData

    Connection data of the host.

    Declaration
    public RelayConnectionData HostConnectionData
    Field Value
    Type Description
    RelayConnectionData

    Connection data structure.

    IsSecure

    Whether the connection is using a secure protocol or not.

    Declaration
    public readonly byte IsSecure
    Field Value
    Type Description
    byte

    True if using DTLS or WSS, false if using UDP.

    IsWebSocket

    Whether the connection is using the WebSocket protocol.

    Declaration
    public readonly byte IsWebSocket
    Field Value
    Type Description
    byte

    True if using WSS, false if using UDP or DTLS.

    Nonce

    Nonce that will be used in the connection handshake.

    Declaration
    public ushort Nonce
    Field Value
    Type Description
    ushort

    HMAC key nonce.

    Methods

    IncrementNonce()

    Increment the nonce and recompute the HMAC.

    Declaration
    public void IncrementNonce()
    In This Article
    Back to top
    Copyright © 2024 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)