Legacy Documentation: Version 5.4
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ConnectionConfig

class in UnityEngine.Networking

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

This class defines parameters of connection between two peers, this definition includes various timeouts and sizes as well as channel configuration.

The NetworkServer and NetworkClient classes can be configured with instances of this class. This causes the settings in the ConnectionConfig to be applied to the transport layer connection of the NetworkConnections owned by these objects.

The NetworkManager has a ConnectionConfig object that is used to configure servers and clients that it creates.

The default channel connection configuration used by the high level components of the networking system is: * channel 0 - Reliable Sequenced channel * channel 1 - Unreliable channel.

Some of the attributes of this ConnectionConfig instance can be modified using the inspector UI for the NetworkManager in the editor.

Variables

AckDelayHow long in ms receiver will wait before it will force send acknowledgements back without waiting any payload.
AllCostTimeoutDefines timeout in ms after that message with AllCost deliver qos will force resend without acknowledgement waiting.
ChannelCountReturn amount of channels for current configuration.
ChannelsAllow access to channels list.
ConnectTimeoutTimeout in ms which library will wait before it will send another connection request.
DisconnectTimeoutHow long (in ms) library will wait before it will consider connection as disconnected.
FragmentSizeWhat should be maximum fragment size (in Bytes) for fragmented messages.
IsAcksLongIf it is true, connection will use 64 bit mask to acknowledge received reliable messages.
MaxCombinedReliableMessageCountMaximum amount of small reliable messages which will combine in one "array of messages". Useful if you are going to send a lot of small reliable messages.
MaxCombinedReliableMessageSizeMaximum size of reliable message which library will consider as small and will try to combine in one "array of messages" message.
MaxConnectionAttemptHow many attempt library will get before it will consider the connection as disconnected.
MaxSentMessageQueueSizeDefines maximum messages which will wait for sending before user will receive error on Send() call.
MinUpdateTimeoutMinimal send update timeout (in ms) for connection. this timeout could be increased by library if flow control will required.
NetworkDropThresholdHow many (in %) packet need to be dropped due network condition before library will throttle send rate.
OverflowDropThresholdHow many (in %) packet need to be dropped due lack of internal bufferes before library will throttle send rate.
PacketSizeWhat is a maximum packet size (in Bytes) (including payload and all header). Packet can contain multiple messages inside.
PingTimeoutTimeout in ms between control protocol messages.
ReducedPingTimeoutTimeout in ms for control messages which library will use before it will accumulate statistics.
ResendTimeoutMinimum timeout (in ms) which library will wait before it will resend reliable message.
UsePlatformSpecificProtocolsWhen starting a server use protocols that make use of platform specific optimisations where appropriate rather than cross-platform protocols. (Sony consoles only).
WebSocketReceiveBufferMaxSizeDefines received buffer size for web socket host; you should set this to the size of the biggest legal frame that you support. If the frame size is exceeded, there is no error, but the buffer will spill to the user callback when full. In case zero 4k buffer will be used. Default value is zero.

Constructors

ConnectionConfigWill create default connection config or will copy them from another.

Public Functions

AddChannel
GetChannelReturn the QoS set for the given channel or throw an out of range exception.

Static Functions

ValidateValidate parameters of connection config. Will throw exceptions if parameters are incorrect.