-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
37 lines (34 loc) · 985 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System.Xml.Serialization;
namespace SimpleMultithreadedAsuncHttpServer
{
class Program
{
static async Task Main(string[] args)
{
using (HttpServer server = new HttpServer(8080)) // порт 8080
{
Task servertask = server.ListenAsync();
while (true)
{
string input = Console.ReadLine();
if (input == "stop")
{
Console.WriteLine("Остановка сервера...");
server.source.Cancel();
server.Stop();
break;
}
}
await servertask;
}
Console.WriteLine("Нажмите любую клавишу для выхода...");
Console.ReadKey(true);
}
}
enum LineState
{
None,
LF,
CR
}
}