Version: 2019.3
LanguageEnglish
  • C#
Method group is Obsolete

ConnectionConfig.DisconnectTimeout

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

Submission failed

For 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.

Close

Cancel

Obsolete public uint DisconnectTimeout;

Description

Defines the timeout in milliseconds before a connection is considered to have been disconnected. Default value = 2000.

Unity Multiplayer defines conditions under which a connection is considered as disconnected. Disconnection can happen for the following reasons:
(1) A disconnection request was received.
(2) The connection has not received any traffic at all for a time longer than DisconnectTimeout (Note that live connections receive regular keep-alive packets, so in this case "no traffic" means not only no user traffic but also absence of any keep-alive traffic as well).
(3) Flow control determines that the time between sending packets is longer than DisconnectTimeout. Keep-alive packets are regularly delivered from peers and contain statistical information. This information includes values of packet loss due to network and peer overflow conditions. Setting NetworkDropThreshold and OverflowDropThreshold defines thresholds for flow control which can decrease packet frequency. When the time before sending the next packet is longer than DisconnectTimeout, the connection will be considered as disconnected and a disconnect event is received.

using UnityEngine;
using UnityEngine.Networking;

public class ExampleScript : MonoBehaviour { void Start() { ConnectionConfig myConfig = new ConnectionConfig(); myConfig.DisconnectTimeout = 5000; //5 seconds } }