Struct NetworkDriver.Concurrent
The Concurrent struct is used to create an Concurrent instance of the GenericNetworkDriver.
Namespace: Unity.Networking.Transport
Syntax
public struct Concurrent
Methods
AbortSend(DataStreamWriter)
Aborts a asynchronous send.
Declaration
public void AbortSend(DataStreamWriter writer)
Parameters
Type | Name | Description |
---|---|---|
DataStreamWriter | writer | If you require the payload to be of certain size. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If endsend is called with a matching BeginSend call. |
InvalidOperationException | If the connection got closed between the call of being and end send. |
BeginSend(NetworkConnection, out DataStreamWriter, Int32)
Acquires a DataStreamWriter for starting a asynchronous send.
Declaration
public int BeginSend(NetworkConnection id, out DataStreamWriter writer, int requiredPayloadSize = 0)
Parameters
Type | Name | Description |
---|---|---|
NetworkConnection | id | The NetworkConnection id to write through |
DataStreamWriter | writer | A DataStreamWriter to write to |
Int32 | requiredPayloadSize | If you require the payload to be of certain size |
Returns
Type | Description |
---|---|
Int32 | Returns Success on a successful acquire. Otherwise returns an StatusCode indicating the error. |
Remarks
Will throw a InvalidOperationException if the connection is in a Connecting state.
BeginSend(NetworkPipeline, NetworkConnection, out DataStreamWriter, Int32)
Acquires a DataStreamWriter for starting a asynchronous send.
Declaration
public int BeginSend(NetworkPipeline pipe, NetworkConnection id, out DataStreamWriter writer, int requiredPayloadSize = 0)
Parameters
Type | Name | Description |
---|---|---|
NetworkPipeline | pipe | The NetworkPipeline to write through |
NetworkConnection | id | The NetworkConnection id to write through |
DataStreamWriter | writer | A DataStreamWriter to write to |
Int32 | requiredPayloadSize | If you require the payload to be of certain size |
Returns
Type | Description |
---|---|
Int32 | Returns Success on a successful acquire. Otherwise returns an StatusCode indicating the error. |
Remarks
Will throw a InvalidOperationException if the connection is in a Connecting state.
EndSend(DataStreamWriter)
Ends a asynchronous send.
Declaration
public int EndSend(DataStreamWriter writer)
Parameters
Type | Name | Description |
---|---|---|
DataStreamWriter | writer | If you require the payload to be of certain size. |
Returns
Type | Description |
---|---|
Int32 | The length of the buffer sent if nothing went wrong. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If endsend is called with a matching BeginSend call. |
InvalidOperationException | If the connection got closed between the call of being and end send. |
GetConnectionState(NetworkConnection)
Declaration
public NetworkConnection.State GetConnectionState(NetworkConnection id)
Parameters
Type | Name | Description |
---|---|---|
NetworkConnection | id |
Returns
Type | Description |
---|---|
NetworkConnection.State |
MaxHeaderSize(NetworkPipeline)
Declaration
public int MaxHeaderSize(NetworkPipeline pipe)
Parameters
Type | Name | Description |
---|---|---|
NetworkPipeline | pipe |
Returns
Type | Description |
---|---|
Int32 |
PopEventForConnection(NetworkConnection, out DataStreamReader)
Declaration
public NetworkEvent.Type PopEventForConnection(NetworkConnection connectionId, out DataStreamReader reader)
Parameters
Type | Name | Description |
---|---|---|
NetworkConnection | connectionId | |
DataStreamReader | reader |
Returns
Type | Description |
---|---|
NetworkEvent.Type |