private void KeepListening() { // While the server is running while (ServRunning == true) { // Accept a pending connection tcpClient = tlsClient.AcceptTcpClient(); // Create a new instance of Connection ChatConnection newConnection = new ChatConnection(tcpClient); } }
public void StopListening() { ChatConnection newConn = new ChatConnection(tcpClient); newConn.CloseConnection(); ServRunning = false; htUsers.Clear(); htConnections.Clear(); ServRunning = false; tcpClient.Close(); tlsClient.Stop(); thrListener.Abort(); }