public void Disconnect() { //ServerForm server = new ServerForm(); if (AcceptSocket != null) { AcceptSocket.Close(); AcceptSocket.Dispose(); } if (ConnectSocket != null) { ConnectSocket.Close(); ConnectSocket.Dispose(); } /* * ServerForm server = new ServerForm(); * * if (server.AcceptSocket != null) * { * server.AcceptSocket.Close(); * server.AcceptSocket.Dispose(); * } * if (server.ConnectSocket != null) * { * server.ConnectSocket.Close(); * server.ConnectSocket.Dispose(); * } */ }
private void _DisConnect() { Pool.TcpServer.OnDisConnect(this); ConnectDateTime = null; if (ConnectSocket != null) { try { ConnectSocket.Shutdown(SocketShutdown.Both); } catch (Exception e) { //日志记录 Pool.TcpServer.Loger.Fatal(string.Format("CloseClientSocket Disconnect client {0} error, message: {1}", ConnectSocket, e.Message)); } ConnectSocket.Dispose(); ConnectSocket = null; } }
public void DisConnect() { OnDisConnect(this); if (ConnectSocket != null) { try { ConnectSocket.Shutdown(SocketShutdown.Both); } catch (Exception e) { //日志记录 loger.Fatal(string.Format("CloseClientSocket Disconnect client {0} error, message: {1}", ConnectSocket, e.Message)); } ConnectSocket.Dispose(); ConnectSocket = null; } Clear(); ReceiveEventArgs.Dispose(); SendEventArgs.Dispose(); }