DisConnection() public méthode

关闭连接
public DisConnection ( ) : void
Résultat void
Exemple #1
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// 重连当前连接
        /// </summary>
        public void ReConnect()
        {
            CNetTCPSocketConnect c = null;

            if (m_TCPConnects.TryGetValue(m_currentConnectedSID, out c))
            {
                c.DisConnection();
                c.Reconnect();
            }
        }
Exemple #2
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// 断开连接
        /// </summary>
        /// <param name="id"></param>
        public void Disconnect(int id)
        {
            CNetTCPSocketConnect c = null;

            if (m_TCPConnects.TryGetValue(id, out c))
            {
                if (null != c)
                {
                    Debug.Log("CNetTCPWork::Disconnect Remove ID = " + id);
                    c.DisConnection();
                    m_TCPConnects[id] = null;
                    if (id == m_currentConnectedSID)
                    {
                        m_currentConnectState = ENUM_SOCKET_STATE.eSocket_DisConnected;
                    }
                }
                m_TCPConnects.Remove(id);
            }
        }