static void Main(string[] args) { Console.WriteLine("Press wait to start the server!"); AutoServer autoServer = new AutoServer(); autoServer.EventReceiveThreadMessage += new Model.EventMessageHandler(EventReceiveThreadMessage); if (!autoServer.StartServer()) { Console.WriteLine("The server started fail!"); return; } Console.WriteLine(); Console.WriteLine("The server started successfully, press key 'q' to stop it!"); while (Console.ReadKey().KeyChar != 'q') { Console.WriteLine(); continue; } autoServer.StopServer(); //Stop the appServer //websocketserver.Stop(); Console.WriteLine("The server was stopped!"); Console.ReadKey(); }
protected override void OnStop() { m_AutoServer.StopServer(); }