I want to listen web browser's request on client. I know that I should use HttpListener
but I had no idea that use from asynchronous or synchronous? Use BeginGetContext
or GetContext
?
try
{
HttpListener listener = new HttpListener();
listener.Prefixes.Add[this is not a link]("http://127.0.0.1:9080/");
listener.Start();
Console.WriteLine("im listening...");
HttpListenerContext context = listener.GetContext();
HttpListenerRequest request = context.Request;
}
catch(exception e)
{
console.writeline(e.tostring());
}