Struct NetworkConfigParameter
Configuration structure for a NetworkDriver, containing general parameters.
Inherited Members
Namespace: Unity.Networking.Transport
Syntax
public struct NetworkConfigParameter : INetworkParameter
Fields
connectTimeoutMS
Time between connection attempts.
Declaration
public int connectTimeoutMS
Field Value
Type | Description |
---|---|
Int32 | Timeout in milliseconds. |
disconnectTimeoutMS
Inactivity timeout for a connection. If nothing is received on a connection for this amount of time, it is disconnected (a Disconnect event will be generated). To prevent this from happenning when the game session is simply quiet, set heartbeatTimeoutMS to a positive non-zero value.
Declaration
public int disconnectTimeoutMS
Field Value
Type | Description |
---|---|
Int32 | Timeout in milliseconds. |
fixedFrameTimeMS
Fixes a fixed amount of time to be used each frame for the purpose of timeout calculations. For example, setting this value to 1000 will have the driver consider that 1 second passed between each call to ScheduleUpdate(JobHandle), even if that's not actually the case. Only useful for testing scenarios, where deterministic behavior is more important than correctness.
Declaration
public int fixedFrameTimeMS
Field Value
Type | Description |
---|---|
Int32 | Timeout in milliseconds. |
heartbeatTimeoutMS
Time after which if nothing from a peer is received, a heartbeat message will be sent to keep the connection alive. Prevents the disconnectTimeoutMS mechanism from kicking when nothing happens on a connection. A value of 0 will disable heartbeats.
Declaration
public int heartbeatTimeoutMS
Field Value
Type | Description |
---|---|
Int32 | Timeout in milliseconds. |
maxConnectAttempts
Maximum number of connection attempts to try. If no answer is received from the server after this number of attempts, a Disconnect event is generated for the connection.
Declaration
public int maxConnectAttempts
Field Value
Type | Description |
---|---|
Int32 | Number of attempts. |
maxFrameTimeMS
Maximum amount of time a single frame can advance timeout values. In this scenario, a frame is defined as the time between two ScheduleUpdate(JobHandle) calls. Useful when debugging to avoid connection timeouts.
Declaration
public int maxFrameTimeMS
Field Value
Type | Description |
---|---|
Int32 | Timeout in milliseconds. |
receiveQueueCapacity
Capacity of the receive queue. This should be the maximum number of packets expected to be received in a single update (each frame). The best value for this will depend heavily on the game type, but generally should be a multiple of the maximum number of players. The only impact of increasing this value is increased memory usage, with an expected ~1400 bytes of memory being used per unit of capacity. The queue is shared across all connections, so servers should set this higher than clients.
Declaration
public int receiveQueueCapacity
Field Value
Type | Description |
---|---|
Int32 | Queue capacity in number of packets. |
reconnectionTimeoutMS
Time after which to attempt to re-establish a connection if nothing is received from the peer. This is used to re-establish connections for example when a peer's IP address changes (e.g. mobile roaming scenarios). To be effective, should be less than disconnectTimeoutMS but greater than heartbeatTimeoutMS. A value of 0 will disable this functionality.
Declaration
public int reconnectionTimeoutMS
Field Value
Type | Description |
---|---|
Int32 | Timeout in milliseconds. |
sendQueueCapacity
Capacity of the send queue. This should be the maximum number of packets expected to be send in a single update (each frame). The best value will depend heavily on the game type, but generally should be a multiple of the maximum number of players. The only impact of increasing this value is increased memory usage, with an expected ~1400 bytes of memory being used per unity of capacity. The queue is shared across all connections, so servers should set this higher than clients.
Declaration
public int sendQueueCapacity
Field Value
Type | Description |
---|---|
Int32 | Queue capacity in number of packets. |
Methods
Validate()
Checks if the values for all fields are valid. This method will be automatically called when adding parameters to the NetworkSettings.
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
Boolean | True if the parameter is valid, false otherwise. |