Пример #1
0
 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();
 }
Пример #2
0
 public HttpProcessor(TcpClient s, HttpServer srv)
 {
     TcpSocket = s;
     Srv = srv;
 }
Пример #3
0
        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);
            }
        }