/// <summary> /// Stops the server from accepting new connections and closes all previously created connections. /// </summary> public void Close() { lock (_socket) { _accepting = false; } _socket.Close(); foreach (Socket socket in _connectedSockets.ToList()) { lock (_sendEventArgsQueue) { TcpHelper.DisconnectAsync(socket, _sendEventArgsQueue, OnSent); } } }
/// <summary> /// Closes the connection. /// </summary> public void Close() { lock (_sendEventArgsQueue) { TcpHelper.DisconnectAsync(_socket, _sendEventArgsQueue, OnSent); } }
/// <summary> /// Kicks the speicifed socket from the server. /// </summary> /// <param name="socket">The socket to kick.</param> public void Disconnect(Socket socket) { lock (_sendEventArgsQueue) { TcpHelper.DisconnectAsync(socket, _sendEventArgsQueue, OnSent); } }