Select your preferred scripting language. All code snippets will be displayed in this language.
class in UnityEngine.Networking
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.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseThis 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.
AckDelay | How long in ms receiver will wait before it will force send acknowledgements back without waiting any payload. |
AllCostTimeout | Defines timeout in ms after that message with AllCost deliver qos will force resend without acknowledgement waiting. |
ChannelCount | Return amount of channels for current configuration. |
Channels | Allow access to channels list. |
ConnectTimeout | Timeout in ms which library will wait before it will send another connection request. |
DisconnectTimeout | How long (in ms) library will wait before it will consider connection as disconnected. |
FragmentSize | What should be maximum fragment size (in Bytes) for fragmented messages. |
IsAcksLong | If it is true, connection will use 64 bit mask to acknowledge received reliable messages. |
MaxCombinedReliableMessageCount | Maximum 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. |
MaxCombinedReliableMessageSize | Maximum size of reliable message which library will consider as small and will try to combine in one "array of messages" message. |
MaxConnectionAttempt | How many attempt library will get before it will consider the connection as disconnected. |
MaxSentMessageQueueSize | Defines maximum messages which will wait for sending before user will receive error on Send() call. |
MinUpdateTimeout | Minimal send update timeout (in ms) for connection. this timeout could be increased by library if flow control will required. |
NetworkDropThreshold | How many (in %) packet need to be dropped due network condition before library will throttle send rate. |
OverflowDropThreshold | How many (in %) packet need to be dropped due lack of internal bufferes before library will throttle send rate. |
PacketSize | What is a maximum packet size (in Bytes) (including payload and all header). Packet can contain multiple messages inside. |
PingTimeout | Timeout in ms between control protocol messages. |
ReducedPingTimeout | Timeout in ms for control messages which library will use before it will accumulate statistics. |
ResendTimeout | Minimum timeout (in ms) which library will wait before it will resend reliable message. |
UsePlatformSpecificProtocols | When starting a server use protocols that make use of platform specific optimisations where appropriate rather than cross-platform protocols. (Sony consoles only). |
WebSocketReceiveBufferMaxSize | Defines 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. |
ConnectionConfig | Will create default connection config or will copy them from another. |
AddChannel | |
GetChannel | Return the QoS set for the given channel or throw an out of range exception. |
Validate | Validate parameters of connection config. Will throw exceptions if parameters are incorrect. |