static void Main(string[] args) { _handler += Handler; SetConsoleCtrlHandler(_handler, true); AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper; TalkyLog.Debug("Server|Starting|"); Console.Write("Starting server... "); int port = 0; if (args.Length > 0) { string thePort = args[0]; int.TryParse(thePort, out port); } if (port <= 0) { port = 4096; } Console.WriteLine($" on port {port}"); _chatServer1 = new ChatServer(port); WaitForAnotherInstance(); ManageInstances(); _chatServer1.Init(); try { (new Thread(_chatServer1.Start)).Start(); } catch (System.Exception ex) { Console.Write($"Server start error : {ex}"); } }