I want to create Windows Service that acts as a HTTP listener and can handle around 500 clients. Are there any special considerations for this kind of service.
I am a little confused between the HTTPListener class and the TCPListener class. Which one to use for a Windows Service that will:
- Accept the client connection (around 500)
- Process client request
- Call another Http based service
- Return some value to the calling client
This is what I am doing to start the listener.
listener = new HttpListener();
listener.Prefixes.Add("http://localhost:8080/");
listener.Start();
listener.BeginGetContext(new AsyncCallback(OnRequestReceive), listener);
private void OnRequestReceive(IAsyncResult result)
{
HttpListener listener = (HttpListener)result.AsyncState;
// Call EndGetContext to complete the asynchronous operation.
HttpListenerContext context = listener.EndGetContext(result);
HttpListenerRequest request = context.Request;
}
Will I be able to handle N clients simultaneously?