/// <summary> /// Stops listening for and disconnects all current connections /// </summary> public void Stop() { while (_clients.Count > 0) _clients[0].Socket.Disconnect(); _listenProc?.Cancel(); _listenProc?.Join(1000); _listenProc = null; _server?.Stop(); IsListening = false; }
/// <summary> /// Stops listening for and disconnects all current connections /// </summary> public void Stop() { while (_clients.Count > 0) { _clients[0].DisconnectAsync().Wait(); } _listenProc?.Cancel(); _listenProc?.Join(1000); _listenProc = null; _server?.Stop(); IsListening = false; }