views:

243

answers:

2

Why the HttpListener class creates a new web server process, instead of use the normal Socket and a HTTP implementation?

+1  A: 

I have never used this class before, but my guess is that the HttpListener is actually connecting itself to an existing web server process running in windows ? Just a guess.

Andrew Keith
+3  A: 

HttpListener is a wrapper for http.sys (HTTP Server API) which is available in Windows XP SP2 or higher. It instructs http.sys to listen for HTTP requests to specific virtual hosts / ports, and when there is a request, "gives" the response data to http.sys which returns it to the client.

Clear advantages are performance and the possibility to share IP addresses and ports with other processes such as Internet Information Server (IIS). That means you can run a virtual host in your process and a virtual host in IIS on the same IP and port.

Stefan Schultze