private void ListenThread() { try { this.Listener.Start(); while (true) { Thread.Sleep(100); ClientSQL.CronCheck(); if (!GlobalVar.b_serverRunning) { return; } if (this.Listener.Pending()) { new Thread(new ParameterizedThreadStart(HandleClient)).Start(Listener.AcceptTcpClient()); } } } catch (Exception ex) { GlobalVar.b_serverRunning = false; Console.Clear(); GlobalFunc.WriteError(ConsoleColor.Red, "[ERROR]", "Error ListenThread! Reason: {0}", ex.Message); GlobalFunc.DelayedRestart(3); } }