Struct 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.
Implements
Inherited Members
Namespace: Unity.Networking.Transport
Assembly: solution.dll
Syntax
public struct NetworkDriver : IDisposable
Constructors
Name | Description |
---|---|
Network |
Use Create(Network |
Network |
Use Create(Network |
Properties
Name | Description |
---|---|
Bound | Whether the driver has been bound to an endpoint with the Bind(Network |
Current |
Current settings used by the driver. |
Is |
Whether the driver is been correctly created. |
Listening | Whether the driver is listening for new connections (e.g. acting like a server). Use the Listen() method to start listening for new connections. |
Receive |
Error code raised by the last receive job, if any. |
Methods
Name | Description |
---|---|
Abort |
Aborts a send started with Begin |
Accept() | Accept any new incoming connections. Connections must be accepted before data can be
sent on them. It's also the only way to obtain the Network |
Begin |
Begin sending data on the given connection (default pipeline). |
Begin |
Begin sending data on the given connection and pipeline. |
Bind(Network |
Bind the driver to an endpoint. This endpoint would normally be a local IP address and
port which the driver will use for its communications. Binding to a wildcard address
(Any |
Connect(Network |
Establish a new connection to the given endpoint. Note that this only starts establishing the new connection. From there it will either succeeds (a Connect event will pop on the connection) or fail (a Disconnect event will pop on the connection) at a later time. |
Create() | Create a new |
Create(Network |
Create a new |
Create |
Create a new pipeline from stage types. |
Create |
Create a new pipeline from stage IDs. |
Create<N>(N) | Create a new |
Create<N>(N, Network |
Create a new |
Create<N>(ref N) | Create a new |
Create<N>(ref N, Network |
Create a new |
Disconnect(Network |
Close a connection. Note that to properly notify a peer of this disconnection, it is
required to schedule at least one update with Schedule |
Dispose() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
End |
Enqueue a send operation for the data in the given Data |
Get |
Get the current state of the given connection. |
Get |
Returns the size of the event queue for a specific connection. This is the number of
events that could be popped with Pop |
Get |
Get the local endpoint used by the driver (the endpoint remote peers will use to reach this driver). |
Get |
Get the low-level pipeline buffers for a given pipeline stage on a given pipeline and for a given connection. Can be used to extract information from a pipeline at runtime. Note that this is a low-level API which is not recommended for general use. |
Get |
Get the remote endpoint of a connection (the endpoint used to reach the remote peer on the connection). |
Listen() | Set the driver to Listen for incomming connections |
Local |
Obsolete. Use Get |
Max |
Get the maximum size of headers when sending on the given pipeline. |
Pop |
Pops the next event from the event queue, Empty will be returned if there are no more events to pop. |
Pop |
Pops the next event from the event queue, Empty will be returned if there are no more events to pop. |
Pop |
Pops the next event from the event queue for the given connection, Empty will be returned if there are no more events. |
Pop |
Pops the next event from the event queue for the given connection, Empty will be returned if there are no more events. |
Register |
Register a custom pipeline stage. |
Remote |
Obsolete. Use Get |
Schedule |
Schedule a send job. This job is basically a subset of the update job (see
Schedule |
Schedule |
Schedule an update job. This job will process incoming packets and check timeouts
(queueing up the relevant events to be consumed by Pop |
To |
Create a Network |