Ejemplo n.º 1
0
        private static async Task HttpServer()
        {
            CoopScheduler.AddTask(async() =>
            {
                while (true)
                {
                    await Task.Delay(1000);
                    Console.WriteLine("waiting");
                }
            });

            HttpListener l = new HttpListener();

            l.Prefixes.Add("http://+:8080/");
            l.Start();
            while (true)
            {
                var ctx = await l.GetContextAsync();

                CoopScheduler.AddTask(() => HandleRequest(ctx));
            }
        }
Ejemplo n.º 2
0
 public static void StartServerAt(string port)
 {
     CoopScheduler.AddTask(HttpServer);
     CoopScheduler.StartScheduler();
 }
Ejemplo n.º 3
0
 static void Main(string[] args)
 {
     CoopScheduler.AddTask(httpServer);
     CoopScheduler.StartScheduler();
 }