Struct GenericNetworkDriver<T, TNetworkPipelineStageCollection> | Unity Transport | 0.2.4-preview.0
docs.unity3d.com
    Show / Hide Table of Contents

    Struct GenericNetworkDriver<T, TNetworkPipelineStageCollection>

    The GenericNetworkDriver is an implementation of Virtual Connections over any transport.

    Basic usage:

    var driver = new GenericNetworkDriver<IPv4UDPSocket>(new INetworkParameter[0]);
    Namespace: Unity.Networking.Transport
    Syntax
    public struct GenericNetworkDriver<T, TNetworkPipelineStageCollection> : INetworkDriver, IDisposable, INetworkPacketReceiver, INetworkPipelineReceiver where T : struct, INetworkInterface where TNetworkPipelineStageCollection : struct, INetworkPipelineStageCollection
    Type Parameters
    Name Description
    T

    Should be of type INetworkInterface, the currently available NetworkInterfaces are IPv4UDPSocket, or IPCSocket.

    TNetworkPipelineStageCollection

    Constructors

    GenericNetworkDriver(INetworkParameter[])

    Constructor for GenericNetworkDriver.

    Declaration
    public GenericNetworkDriver(params INetworkParameter[] param)
    Parameters
    Type Name Description
    INetworkParameter[] param

    An array of INetworkParameter. There are currently only two INetworkParameter, the NetworkDataStreamParameter and the NetworkConfigParameter.

    Properties

    IsCreated

    Declaration
    public bool IsCreated { get; }
    Property Value
    Type Description
    Boolean
    Implements
    INetworkDriver.IsCreated

    Listening

    Declaration
    public bool Listening { get; }
    Property Value
    Type Description
    Boolean
    Implements
    INetworkDriver.Listening

    ReceiveCount

    Declaration
    public int ReceiveCount { get; set; }
    Property Value
    Type Description
    Int32
    Implements
    INetworkPacketReceiver.ReceiveCount

    ReceiveErrorCode

    Declaration
    public int ReceiveErrorCode { get; set; }
    Property Value
    Type Description
    Int32
    Implements
    INetworkPacketReceiver.ReceiveErrorCode

    Methods

    Accept()

    Declaration
    public NetworkConnection Accept()
    Returns
    Type Description
    NetworkConnection
    Implements
    INetworkDriver.Accept()

    AppendPacket(NetworkEndPoint, UdpCHeader, Int32)

    Declaration
    public int AppendPacket(NetworkEndPoint address, UdpCHeader header, int dataLen)
    Parameters
    Type Name Description
    NetworkEndPoint address
    UdpCHeader header
    Int32 dataLen
    Returns
    Type Description
    Int32
    Implements
    INetworkPacketReceiver.AppendPacket(NetworkEndPoint, UdpCHeader, Int32)

    Bind(NetworkEndPoint)

    Declaration
    public int Bind(NetworkEndPoint endpoint)
    Parameters
    Type Name Description
    NetworkEndPoint endpoint
    Returns
    Type Description
    Int32
    Implements
    INetworkDriver.Bind(NetworkEndPoint)

    Connect(NetworkEndPoint)

    Declaration
    public NetworkConnection Connect(NetworkEndPoint endpoint)
    Parameters
    Type Name Description
    NetworkEndPoint endpoint
    Returns
    Type Description
    NetworkConnection
    Implements
    INetworkDriver.Connect(NetworkEndPoint)

    CreatePipeline(Type[])

    Declaration
    public NetworkPipeline CreatePipeline(params Type[] stages)
    Parameters
    Type Name Description
    Type[] stages
    Returns
    Type Description
    NetworkPipeline
    Implements
    INetworkDriver.CreatePipeline(Type[])

    Disconnect(NetworkConnection)

    Declaration
    public int Disconnect(NetworkConnection id)
    Parameters
    Type Name Description
    NetworkConnection id
    Returns
    Type Description
    Int32
    Implements
    INetworkDriver.Disconnect(NetworkConnection)

    Dispose()

    Declaration
    public void Dispose()

    DynamicDataStreamSize()

    Declaration
    public bool DynamicDataStreamSize()
    Returns
    Type Description
    Boolean
    Implements
    INetworkPacketReceiver.DynamicDataStreamSize()

    GetConnectionState(NetworkConnection)

    Declaration
    public NetworkConnection.State GetConnectionState(NetworkConnection con)
    Parameters
    Type Name Description
    NetworkConnection con
    Returns
    Type Description
    NetworkConnection.State
    Implements
    INetworkDriver.GetConnectionState(NetworkConnection)

    GetDataStream()

    Declaration
    public DataStreamWriter GetDataStream()
    Returns
    Type Description
    DataStreamWriter
    Implements
    INetworkPacketReceiver.GetDataStream()

    GetPipelineBuffers(Type, NetworkConnection, ref NativeSlice<Byte>, ref NativeSlice<Byte>, ref NativeSlice<Byte>)

    Declaration
    public void GetPipelineBuffers(Type pipelineType, NetworkConnection connection, ref NativeSlice<byte> readProcessingBuffer, ref NativeSlice<byte> writeProcessingBuffer, ref NativeSlice<byte> sharedBuffer)
    Parameters
    Type Name Description
    Type pipelineType
    NetworkConnection connection
    NativeSlice<Byte> readProcessingBuffer
    NativeSlice<Byte> writeProcessingBuffer
    NativeSlice<Byte> sharedBuffer

    GetPipelineBuffers(NetworkPipeline, Int32, NetworkConnection, ref NativeSlice<Byte>, ref NativeSlice<Byte>, ref NativeSlice<Byte>)

    Declaration
    public void GetPipelineBuffers(NetworkPipeline pipeline, int stageId, NetworkConnection connection, ref NativeSlice<byte> readProcessingBuffer, ref NativeSlice<byte> writeProcessingBuffer, ref NativeSlice<byte> sharedBuffer)
    Parameters
    Type Name Description
    NetworkPipeline pipeline
    Int32 stageId
    NetworkConnection connection
    NativeSlice<Byte> readProcessingBuffer
    NativeSlice<Byte> writeProcessingBuffer
    NativeSlice<Byte> sharedBuffer

    Listen()

    Declaration
    public int Listen()
    Returns
    Type Description
    Int32
    Implements
    INetworkDriver.Listen()

    LocalEndPoint()

    Declaration
    public NetworkEndPoint LocalEndPoint()
    Returns
    Type Description
    NetworkEndPoint
    Implements
    INetworkDriver.LocalEndPoint()

    PopEvent(out NetworkConnection, out DataStreamReader)

    Declaration
    public NetworkEvent.Type PopEvent(out NetworkConnection con, out DataStreamReader slice)
    Parameters
    Type Name Description
    NetworkConnection con
    DataStreamReader slice
    Returns
    Type Description
    NetworkEvent.Type
    Implements
    INetworkDriver.PopEvent(out NetworkConnection, out DataStreamReader)

    PopEventForConnection(NetworkConnection, out DataStreamReader)

    Declaration
    public NetworkEvent.Type PopEventForConnection(NetworkConnection connectionId, out DataStreamReader slice)
    Parameters
    Type Name Description
    NetworkConnection connectionId
    DataStreamReader slice
    Returns
    Type Description
    NetworkEvent.Type
    Implements
    INetworkDriver.PopEventForConnection(NetworkConnection, out DataStreamReader)

    PushDataEvent(NetworkConnection, NativeSlice<Byte>)

    Declaration
    public void PushDataEvent(NetworkConnection con, NativeSlice<byte> data)
    Parameters
    Type Name Description
    NetworkConnection con
    NativeSlice<Byte> data
    Implements
    INetworkPipelineReceiver.PushDataEvent(NetworkConnection, NativeSlice<Byte>)

    RemoteEndPoint(NetworkConnection)

    Declaration
    public NetworkEndPoint RemoteEndPoint(NetworkConnection id)
    Parameters
    Type Name Description
    NetworkConnection id
    Returns
    Type Description
    NetworkEndPoint
    Implements
    INetworkDriver.RemoteEndPoint(NetworkConnection)

    ScheduleUpdate(JobHandle)

    Declaration
    public JobHandle ScheduleUpdate(JobHandle dep = null)
    Parameters
    Type Name Description
    JobHandle dep
    Returns
    Type Description
    JobHandle
    Implements
    INetworkDriver.ScheduleUpdate(JobHandle)

    Send(NetworkPipeline, NetworkConnection, IntPtr, Int32)

    Declaration
    public int Send(NetworkPipeline pipe, NetworkConnection id, IntPtr data, int len)
    Parameters
    Type Name Description
    NetworkPipeline pipe
    NetworkConnection id
    IntPtr data
    Int32 len
    Returns
    Type Description
    Int32
    Implements
    INetworkDriver.Send(NetworkPipeline, NetworkConnection, IntPtr, Int32)

    Send(NetworkPipeline, NetworkConnection, DataStreamWriter)

    Declaration
    public int Send(NetworkPipeline pipe, NetworkConnection id, DataStreamWriter strm)
    Parameters
    Type Name Description
    NetworkPipeline pipe
    NetworkConnection id
    DataStreamWriter strm
    Returns
    Type Description
    Int32
    Implements
    INetworkDriver.Send(NetworkPipeline, NetworkConnection, DataStreamWriter)

    ToConcurrent()

    Create a Concurrent Copy of the NetworkDriver.

    Declaration
    public GenericNetworkDriver<T, TNetworkPipelineStageCollection>.Concurrent ToConcurrent()
    Returns
    Type Description
    GenericNetworkDriver.Concurrent<>
    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