This project is read-only.

Stuck with beta3

Jan 21, 2009 at 8:20 AM

I am trying to convert a beta2 project to beta3, but I am stuck.

I have modified the instantiation of the listener

            listener = new HttpListener(IPAddress.Any, port, new HttpContextFactory(new NullLogWriter(),
                                                                                    new RequestParserFactory()));
            listener.RequestReceived += OnRequest;

But then I don't know what to do with the type signature of OnRequest.

  No overload for 'OnRequest' matches delegate 'System.EventHandler<HttpServer.RequestEventArgs>'

And where is IHttpClientContext?


Jan 21, 2009 at 8:31 AM
Now I found

            listener = HttpListener.Create(IPAddress.Any, port);

but I still don't know what to do with OnRequest().

Jan 21, 2009 at 8:36 AM
it's demonstrated in the first tutorial in the source code.

class Program
  HttpListener _listener;
  public static void Main(string[] args)
     _listener = HttpListener.Create(IPAddress.Any, 50);
     _listener.RequestReceived += OnRequest;

  public static void OnRequest(object source, RequestEventArgs args)
    HttpResponse response = new HttpResponse((IHttpClientContext)source, args.Request);

I'll update the examples in the wiki.