public void Close() { if (clientSocket != null) { TryCatchHelper.Do(() => { clientSocket.Close(); }); } clientSocket = null; }
public void Dispose() { if (this.Socket != null) { TryCatchHelper.Do(() => { this.Socket.Shutdown(SocketShutdown.Both); }); TryCatchHelper.Do(() => { this.Socket.Close(); }); TryCatchHelper.Do(() => { this.Socket.Dispose(); }); this.Socket = null; } this.receiveBuffer = null; this.saea_receive = null; parser = null; Console.WriteLine("ConnectionWorker disposed"); }