【发布时间】:2014-10-10 02:07:08
【问题描述】:
我想在客户端监听网络浏览器的请求。我知道我应该使用HttpListener,但我不知道使用异步还是同步?使用BeginGetContext 或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());
}
【问题讨论】:
标签: sockets http asynchronous httplistener