public void Close() { lock (_semaphore) { if (!_closed) { try { socketConnection.Abort(); } catch (Exception) { // ignore, we are closing anyway } finally { _closed = true; _emptyBuffer = null; } } } }