Class NetworkManagerTransportTests.FailedTransport
Does nothing but simulate a transport that can fail at startup and/or when polling events.
Inheritance
Inherited Members
Namespace: Unity.Netcode.RuntimeTests
Assembly: Unity.Netcode.RuntimeTests.dll
Syntax
public class NetworkManagerTransportTests.FailedTransport : TestingNetworkTransport
Fields
FailOnNextPoll
Declaration
public bool FailOnNextPoll
Field Value
Type | Description |
---|---|
bool |
FailOnStart
Declaration
public bool FailOnStart
Field Value
Type | Description |
---|---|
bool |
Properties
ServerClientId
A constant clientId
that represents the server
When this value is found in methods such as Send
, it should be treated as a placeholder that means "the server"
Declaration
public override ulong ServerClientId { get; }
Property Value
Type | Description |
---|---|
ulong |
Overrides
Methods
DisconnectLocalClient()
Disconnects the local client from the server
Declaration
public override void DisconnectLocalClient()
Overrides
DisconnectRemoteClient(ulong)
Disconnects a client from the server
Declaration
public override void DisconnectRemoteClient(ulong clientId)
Parameters
Type | Name | Description |
---|---|---|
ulong | clientId | The clientId to disconnect |
Overrides
GetCurrentRtt(ulong)
Gets the round trip time for a specific client. This method is optional
Declaration
public override ulong GetCurrentRtt(ulong clientId)
Parameters
Type | Name | Description |
---|---|---|
ulong | clientId | The clientId to get the RTT from |
Returns
Type | Description |
---|---|
ulong | Returns the round trip time in milliseconds |
Overrides
Initialize(NetworkManager)
Initializes the transport
Declaration
public override void Initialize(NetworkManager networkManager = null)
Parameters
Type | Name | Description |
---|---|---|
Network |
networkManager | optionally pass in NetworkManager |
Overrides
PollEvent(out ulong, out ArraySegment<byte>, out float)
Polls for incoming events, with an extra output parameter to report the precise time the event was received.
Declaration
public override NetworkEvent PollEvent(out ulong clientId, out ArraySegment<byte> payload, out float receiveTime)
Parameters
Type | Name | Description |
---|---|---|
ulong | clientId | The clientId this event is for |
Array |
payload | The incoming data payload |
float | receiveTime | The time the event was received, as reported by Time.realtimeSinceStartup. |
Returns
Type | Description |
---|---|
Network |
Returns the event type |
Overrides
Send(ulong, ArraySegment<byte>, NetworkDelivery)
Send a payload to the specified clientId, data and networkDelivery.
Declaration
public override void Send(ulong clientId, ArraySegment<byte> payload, NetworkDelivery networkDelivery)
Parameters
Type | Name | Description |
---|---|---|
ulong | clientId | The clientId to send to |
Array |
payload | The data to send |
Network |
networkDelivery | The delivery type (QoS) to send data with |
Overrides
Shutdown()
Shuts down the transport
Declaration
public override void Shutdown()
Overrides
StartClient()
Connects client to the server
Declaration
public override bool StartClient()
Returns
Type | Description |
---|---|
bool | Returns success or failure |
Overrides
StartServer()
Starts to listening for incoming clients
Declaration
public override bool StartServer()
Returns
Type | Description |
---|---|
bool | Returns success or failure |