docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct BaselibNetworkInterface

    Default NetworkInterface implementation based on Unity's internal Baselib UDP sockets this is ensure to work on all platforms except for Unity's WebGL.

    Implements
    INetworkInterface
    IDisposable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Networking.Transport
    Assembly: Unity.Networking.Transport.dll
    Syntax
    [BurstCompile]
    public struct BaselibNetworkInterface : INetworkInterface, IDisposable

    Fields

    DefaultParameters

    Default Parameters for BaselibNetworkInterface

    Declaration
    public static BaselibNetworkParameter DefaultParameters
    Field Value
    Type Description
    BaselibNetworkParameter

    Properties

    IsCreated

    Gets if the interface has been created.

    Declaration
    public bool IsCreated { get; }
    Property Value
    Type Description
    bool

    LocalEndPoint

    Returns the local endpoint the BaselibNetworkInterface is bound to.

    Declaration
    public NetworkInterfaceEndPoint LocalEndPoint { get; }
    Property Value
    Type Description
    NetworkInterfaceEndPoint

    NetworkInterfaceEndPoint

    Methods

    Bind(NetworkInterfaceEndPoint)

    Binds the medium to a specific endpoint.

    Declaration
    public int Bind(NetworkInterfaceEndPoint endpoint)
    Parameters
    Type Name Description
    NetworkInterfaceEndPoint endpoint

    A valid NetworkInterfaceEndPoint.

    Returns
    Type Description
    int

    Returns 0 on success.

    CreateInterfaceEndPoint(NetworkEndPoint, out NetworkInterfaceEndPoint)

    Converts a generic NetworkEndPoint to its NetworkInterfaceEndPoint version for the BaselibNetworkInterface.

    Declaration
    public int CreateInterfaceEndPoint(NetworkEndPoint address, out NetworkInterfaceEndPoint endpoint)
    Parameters
    Type Name Description
    NetworkEndPoint address

    The NetworkEndPoint endpoint to convert.

    NetworkInterfaceEndPoint endpoint

    The new NetworkInterfaceEndPoint.

    Returns
    Type Description
    int

    returns 0 on success and sets the converted endpoint value

    CreateSendInterface()

    Creates the send interface

    Declaration
    public NetworkSendInterface CreateSendInterface()
    Returns
    Type Description
    NetworkSendInterface

    The network send interface

    Dispose()

    Disposes this instance

    Declaration
    public void Dispose()

    GetGenericEndPoint(NetworkInterfaceEndPoint)

    Converts a NetworkInterfaceEndPoint to its generic NetworkEndPoint version.

    Declaration
    public NetworkEndPoint GetGenericEndPoint(NetworkInterfaceEndPoint endpoint)
    Parameters
    Type Name Description
    NetworkInterfaceEndPoint endpoint

    The NetworkInterfaceEndPoint endpoint to convert.

    Returns
    Type Description
    NetworkEndPoint

    Returns the converted endpoint value.

    Initialize(NetworkSettings)

    Initializes a instance of the BaselibNetworkInterface struct.

    Declaration
    public int Initialize(NetworkSettings settings)
    Parameters
    Type Name Description
    NetworkSettings settings

    NetworkSettings with which to configure the interface.

    Returns
    Type Description
    int

    Returns 0 on success.

    Listen()

    Listens on the socket, currently this Interface doesn't support listening as its UDP based.

    Declaration
    public int Listen()
    Returns
    Type Description
    int

    Returns 0

    ScheduleReceive(NetworkPacketReceiver, JobHandle)

    Schedule a ReceiveJob. This is used to read data from your supported medium and pass it to the AppendData function supplied by NetworkDriver

    Declaration
    public JobHandle ScheduleReceive(NetworkPacketReceiver receiver, JobHandle dep)
    Parameters
    Type Name Description
    NetworkPacketReceiver receiver

    A NetworkDriver used to parse the data received.

    JobHandle dep

    A JobHandle to any dependency we might have.

    Returns
    Type Description
    JobHandle

    A JobHandle to our newly created ScheduleReceive Job.

    ScheduleSend(NativeQueue<QueuedSendMessage>, JobHandle)

    Schedule a SendJob. This is used to flush send queues to your supported medium

    Declaration
    public JobHandle ScheduleSend(NativeQueue<QueuedSendMessage> sendQueue, JobHandle dep)
    Parameters
    Type Name Description
    NativeQueue<QueuedSendMessage> sendQueue

    The send queue which can be used to emulate parallel send.

    JobHandle dep

    A JobHandle to any dependency we might have.

    Returns
    Type Description
    JobHandle

    A JobHandle to our newly created ScheduleSend Job.

    Implements

    INetworkInterface
    IDisposable
    In This Article
    Back to top
    Copyright © 2025 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)