Namespace Unity.Networking.Transport
Classes
BaselibNetworkParameterExtensions
CommonNetworkParametersExtensions
Extensions for NetworkConfigParameter.
ManagedNetworkInterfaceExtensions
Extension methods to work with a managed INetworkInterface.
NetworkSimulatorParameterExtensions
Extensions for NetworkSimulatorParameter.
WebSocketParameterExtensions
Extensions for WebSocketParameter.
Structs
BaselibNetworkInterface
Obsolete. Use UDPNetworkInterface instead.
BaselibNetworkParameter
Obsolete. Set the receive/send queue capacities with NetworkConfigParameter instead.
FragmentationPipelineStage
Pipeline stage that can be used to fragment large packets into MTU-sized chunks. Use this stage when defining pipelines that need to send packets larger than ~1400 bytes.
IPCNetworkInterface
The IPC network interface implements the functionality of a network interface over an in-memory buffer. Operations will be instantaneous, but can only be used to communicate with other NetworkDriver instances inside the same process (so IPC really means intra-process and not inter-process here). Useful for testing, or to implement a single player mode in a multiplayer game.
Note that the interface expects loopback addresses when binding/connecting. It is recommended to only use LoopbackIpv4 when dealing with the IPC network interface, and to use different ports for different drivers (see example).
InboundRecvBuffer
Buffer passed to the Receive
method of a pipeline stage. This type is only useful if
implementing a custom INetworkPipelineStage.
InboundSendBuffer
Buffer passed to the Send
method of a pipeline stage. This type is only useful if
implementing a custom INetworkPipelineStage.
MultiNetworkDriver
The MultiNetworkDriver
structure is a way to manipulate multiple instances of
NetworkDriver at the same time. This abstraction is meant to make it easy to
work with servers that must accept different connection types (e.g. both UDP and WebSocket
connections). This is useful for cross-play support across different platforms.
MultiNetworkDriver.Concurrent
Structure that can be used to access a MultiNetworkDriver
from multiple jobs.
Only a subset of operations are supported because not all operations are safe to perform
concurrently. Must be obtained with the ToConcurrent() method.
NetworkConfigParameter
Configuration structure for a NetworkDriver, containing general parameters.
NetworkConnection
Public representation of a connection. This is obtained by calling Accept(out NativeArray<byte>) (on servers) or Connect(NetworkEndpoint, NativeArray<byte>) (on clients) and acts as a handle to the communication session with a remote peer.
NetworkDriver
The NetworkDriver
is the main API with which users interact with the Unity Transport
package. It can be thought of as a socket with extra features. Refer to the manual for
examples of how to use this API.
NetworkDriver.Concurrent
Structure that can be used to access a NetworkDriver
from multiple jobs. Only a
subset of operations are supported because not all operations are safe to perform
concurrently. Must be obtained with the ToConcurrent() method.
NetworkEndpoint
Representation of an endpoint on the network. Typically, this means an IP address and a port
number, and the API provides means to make working with this kind of endpoint easier.
Analoguous to a sockaddr
structure in traditional BSD sockets.
NetworkEvent
NetworkInterfaceEndPoint
Obsolete. Part of the old INetworkInterface
API.
NetworkInterfaceUnmanagedWrapper<T>
An unmanaged network interface that can act as a wrapper for a managed one. Use WrapToUnmanaged<T>(T) to obtain an instance. Do not create one manually.
NetworkPacketReceiver
Obsolete. Part of the old INetworkInterface
API.
NetworkParameterConstants
Default values used for the different network parameters. These parameters (except the MTU) can be set with WithNetworkConfigParameters(ref NetworkSettings, int, int, int, int, int, int, int, int, int, int).
NetworkPipeline
Identifier for a network pipeline obtained with CreatePipeline(params Type[]).
NetworkPipelineContext
Current context of a pipeline stage instance. This type is only useful if implementing a custom INetworkPipelineStage, where it will get passed to the send and receive methods of the pipeline.
NetworkPipelineStage
Concrete implementation details of a pipeline stage. Only used if implementing custom pipeline stages. Implementors of INetworkPipelineStage are required to produce this structure on static initialization. The values in this structure will then be used at runtime for each pipeline where the stage is used.
NetworkPipelineStageId
Identifier for a pipeline stage.
NetworkSettings
An aggregate of the different parameter structures that describe a network configuration.
NetworkSimulatorParameter
Parameters for the global network simulator.
NullPipelineStage
A pipeline stage that does nothing. This can be useful to create different "channels" of communication for different types of messages, even when these messages do not otherwise require any other guarantees provided by other pipeline stages.
OperationResult
Stores the result of a network operation. This is normally used when a job needs to return a result to its caller. For example the ReceiveJobArguments structure contains one which is used to report the result of receive operations on network interfaces, which is then reported through ReceiveErrorCode.
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.
PacketsQueue
A queue of packets with an internal pool of preallocated packet buffers.
ReceiveJobArguments
Arguments used by receive jobs.
ReliableSequencedPipelineStage
This pipeline stage can be used to ensure that packets sent through it will be delivered, and will be delivered in order. This is done by sending acknowledgements for received packets, and resending packets that have not been acknowledged in a while.
Note that a consequence of these guarantees is that if a packet is lost, subsequent packets will not be delivered until the lost packet has been resent and delivered. This is called head-of-line blocking and can add significant latency to delivered packets when it occurs. For this reason, only send through this pipeline traffic which must absolutely be delivered in order (e.g. RPCs or player actions). State updates that will be resent later anyway (e.g. snapshots) should not be sent through this pipeline stage.
Another reason to limit the amount of traffic sent through this pipeline is because it has limited bandwidth. Because of the need to keep packets around in case they need to be resent, only a limited number of packets can be in-flight at a time. This limit, called the window size, is 32 by default and can be increased to 64. See the documentation on pipelines for further details.
SendJobArguments
Arguments used by send jobs.
SimulatorPipelineStage
This pipeline stage can be used to add artificial network conditions (packet loss, latency, etc.) to the traffic going through it. This is useful to test a game under conditions closer to what can be observed in real networks.
SimulatorPipelineStageInSend
Obsolete. Use SimulatorPipelineStage with an ApplyMode configured for sending instead.
TransportFunctionPointer<T>
Convenience wrapper around a Burst function pointer. Should only be used when defining functions for custom INetworkPipelineStage implementations.
UDPNetworkInterface
Default interface used by NetworkDriver, which will send/receive all traffic over UDP. Not available on WebGL.
UnreliableSequencedPipelineStage
Pipeline stage that can be used to ensure the ordering of packets sent through it. Note that it only guarantees the ordering, it does not make any reliability guarantees. This pipeline stage basically just drops any packet that arrives out-of-order. For reliability guarantees, use the ReliableSequencedPipelineStage.
UnreliableSequencedPipelineStage.SequenceId
Stores per-instance data.
UnreliableSequencedPipelineStage.Statistics
Stores UnreliableSequencedPipelineStage statistics.
WebSocketNetworkInterface
Interface used to establish WebSocket connections.
WebSocketParameter
Parameters for WebSocket connections.
Interfaces
INetworkInterface
Network interfaces are the lowest level of the Unity Transport library. They are responsible for sending and receiving packets directly to/from the network. Conceptually, they act like sockets. Users can provide their own network interfaces by implementing this interface and passing a new instance of it to Create<N>(N).
Note that network interfaces are expected to be unmanaged types compatible with Burst. However, it is possible to write them using managed types and code. Simply wrap them with WrapToUnmanaged<T>(T) before passing them to Create<N>(N). This comes at a small performance cost, but allows writing network interfaces that interact with managed C# libraries.
INetworkParameter
Interface used to implement custom values for use with NetworkSettings. This is only useful to provide configuration settings for custom INetworkInterface or INetworkPipelineStage implementations.
INetworkPipelineStage
Interface that custom pipeline stages must implement.
Enums
NetworkConnection.State
Different states in which a NetworkConnection can be.
NetworkEvent.Type
Types of network events that can be returned by PopEvent(out NetworkConnection, out DataStreamReader).
NetworkFamily
Indicates the type of endpoint a NetworkEndpoint represents. Analoguous to a
sa_family_t
in traditional BSD sockets.
NetworkPacketReceiver.AppendPacketMode
Obsolete. Part of the old INetworkInterface
API.
NetworkPipelineStage.Requests
Requests that a pipeline stage can make in their send and receive methods.
Delegates
NetworkPipelineStage.InitializeConnectionDelegate
Type of the method used to initialize connections.
NetworkPipelineStage.ReceiveDelegate
Type of the method used for the receive direction of the pipeline.
NetworkPipelineStage.SendDelegate
Type of the method used for the send direction of the pipeline.