public void Destory() { try { OnClientExit?.Invoke(null, null); //May not execute in some force close condition? } catch (Exception) { //throw; } }
public void Stop() { if (Interlocked.Exchange(ref _isStopped, 1) != 0) { return; } OnClientExit?.Invoke(this); try { _socket.Close(); } catch (ObjectDisposedException) { // Ignore } }