public void Disconnect() { try { if (IsRunning) { ClientSocket.BeginDisconnect(false, ClientDisconnected, ClientSocket); _leaveRequest = true; } } catch (Exception e) { OnErrorHandled?.Invoke(e); } }