Method group is Obsolete

ConnectionConfig.DisconnectTimeout

Switch to Manual
Obsolete public uint DisconnectTimeout ;

Description

定义将连接视为已断开之前的超时值(以毫秒为单位)。默认值 = 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 } }