RemoveClient() public method

Removes a client from the internal list of connected clients. Should really only be called internally by the NetworkClient.Disconnect() method.
public RemoveClient ( NetworkClient Client ) : void
Client NetworkClient The client to remove.
return void
示例#1
0
        /// <summary>
        /// Disconnects this NetworkClient instance and stops
        /// all sending and receiving of data.
        /// </summary>
        public void Disconnect()
        {
            try
            {
                m_Sock.Shutdown(SocketShutdown.Both);
                m_Sock.Disconnect(true);

                if (m_Listener != null)
                {
                    m_Listener.RemoveClient(this);
                }
            }
            catch
            {
            }
        }
示例#2
0
        /// <summary>
        /// Disconnects this NetworkClient instance and stops
        /// all sending and receiving of data.
        /// </summary>
        public void Disconnect()
        {
            try
            {
                m_Sock.Shutdown(SocketShutdown.Both);
                m_Sock.Disconnect(true);

                if (m_Listener != null)
                {
                    m_Listener.RemoveClient(this);
                }
            }
            catch
            {
            }
            if (m_Connected)
            {
                if (OnDisconnect != null)
                {
                    OnDisconnect();
                }
                m_Connected = false;
            }
        }