mirror of
https://github.com/iminet/dev.git
synced 2024-12-21 13:02:40 +01:00
Create Program.cs
This commit is contained in:
parent
ba3107d03c
commit
d8360b1f53
17
csharp/HttpListener/Program.cs
Normal file
17
csharp/HttpListener/Program.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System.Net;
|
||||
|
||||
using var listener = new HttpListener();
|
||||
listener.Prefixes.Add("http://localhost:8001/");
|
||||
|
||||
listener.Start();
|
||||
|
||||
Console.WriteLine("Listening on port 8001...");
|
||||
|
||||
while (true)
|
||||
{
|
||||
HttpListenerContext ctx = listener.GetContext();
|
||||
using HttpListenerResponse resp = ctx.Response;
|
||||
|
||||
resp.StatusCode = (int) HttpStatusCode.OK;
|
||||
resp.StatusDescription = "Status OK";
|
||||
}
|
Loading…
Reference in New Issue
Block a user