Stuck with beta3

Jan 21, 2009 at 7:20 AM
Hi,

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(),
                                                                                    1000000,
                                                                                    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?

Marcus




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

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

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



Coordinator
Jan 21, 2009 at 7: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;
     _listener.Start();
  }

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

I'll update the examples in the wiki.