Пример #1
0
 /// <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);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Closes the connection.
 /// </summary>
 public void Close()
 {
     lock (_sendEventArgsQueue) {
         TcpHelper.DisconnectAsync(_socket, _sendEventArgsQueue, OnSent);
     }
 }
Пример #3
0
 /// <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);
     }
 }