private void Listen() { TcpListener tcpListener = null; try { tcpListener = new TcpListener(IPAddress.Any, this.Port); tcpListener.Start(); while (this.continueToListen) { if (tcpListener.Pending()) { var tcpClient = tcpListener.AcceptTcpClient(); var clientEndpoint = new ClientEndpoint(this, this.dataContext, tcpClient); clientEndpoint.ProcessPendingConnection(); } else { // Processing current connections foreach (var de in this.clients) { de.Value.ProcessCurrentConnection(); } this.FreeClientsQueuedForRemoval(); // cleanupRooms(); // Free unocupied rooms - deprecated because of saving room params (password) } } } catch (Exception e) { Log.Error(e.ToString); } finally { if (tcpListener != null) { tcpListener.Stop(); } Log.Info("Listening finished"); } }
public void AddLoggedInUser(string login, ClientEndpoint clientEndpoint) { this.clients.Add(login, clientEndpoint); }
private void Listen() { TcpListener tcpListener = null; try { tcpListener = new TcpListener(IPAddress.Any, this.Port); tcpListener.Start(); while (this.continueToListen) { if (tcpListener.Pending()) { var tcpClient = tcpListener.AcceptTcpClient(); var clientEndpoint = new ClientEndpoint(this, this.dataContext, tcpClient); clientEndpoint.ProcessPendingConnection(); } else { // Processing current connections foreach (var de in this.clients) { de.Value.ProcessCurrentConnection(); } this.FreeClientsQueuedForRemoval(); // cleanupRooms(); // Free unocupied rooms - deprecated because of saving room params (password) } } } catch (Exception e) { Log.Error(e.ToString); } finally { if (tcpListener != null) { tcpListener.Stop(); } Log.Info("Listening finished"); } }
public void QueueClientForRemoval(ClientEndpoint clientEndpoint) { this.unusedClients.Add(clientEndpoint.Login); }
public void AddLoggedInUser(string login, ClientEndpoint clientEndpoint) { this.clients.Add(login, clientEndpoint); }
public void QueueClientForRemoval(ClientEndpoint clientEndpoint) { this.unusedClients.Add(clientEndpoint.Login); }