/// <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 { } }
/// <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; } }