public static void ReStartServer() { if (HttpServer == null) return; WriteDisplay("Shutting Down Server"); HttpServer.Stop(); WriteDisplay("Restarting Local Server on Port: " + ServerPort); HttpServer = new PortalHttpServer(ServerPort); MainThread = new Thread(HttpServer.Listen); MainThread.Start(); }
public HttpProcessor(TcpClient s, HttpServer srv) { TcpSocket = s; Srv = srv; }
public static void StartServer() { try { // Startting HTTP server HttpServer = new PortalHttpServer(ServerPort); MainThread = new Thread(HttpServer.Listen); MainThread.Start(); // Starting Cron Job var now = DateTime.Now; var cronSchedule = CronSchedule.Parse("* * * * *"); var cronSchedules = new List<CronSchedule> { cronSchedule }; var dc = new CronObjectDataContext { Object = DateTime.Now, CronSchedules = cronSchedules, LastTrigger = now }; Cron = new CronObject(dc); Cron.OnCronTrigger += Cron_OnCronTrigger; Cron.Start(); // Set button text SetTextBtn(@"Stop"); SetColorDisplay(Color.Aquamarine); WriteDisplay("Server Started on port: " + ServerPort); } catch (Exception) { WriteDisplay("Unable to start server"); SetColorDisplay(Color.Tomato); } }