http_listener

Oct 29, 2014 at 4:34 PM
Edited Oct 29, 2014 at 4:39 PM
I am building a small server based on http_listener. When I construct the http_listener object I initialize it like this:
 http_listener listener(U("http://localhost/"));
Now, when I am on the system the listener is running on I can access it using IE and the URL http://localhost. The access calls the right support function for the call. But, if I type in 192.168.1.xxx (the IP address of the computer) the call is rejected with a 404 error. Also, if I try to access this server from any other computer on our net work the request is also rejected with a 404 error.

Does the listener need to state its URL (eg. http://www.example.com)?

Is there some setup of the http_listener objects that needs to be done to accept both localhost and IP Address requests? The documentation seems vague on this point

Thanks TRS
Oct 30, 2014 at 5:46 PM
Hi TRS,

On Windows listening on 'localhost' doesn't allow off machine traffic. If you want to listen for requests coming off the machine you will need to run with administrative privileges and use '*' as the hostname. This is coming from the Windows HTTP server API we build on top of. Try that out.

Steve
Oct 31, 2014 at 12:00 AM
Hi Steve,

That worked. I'm using "http://*:80" and it works fine. (I always include the port number, mainly because the server will eventually not be using :80)

Thanks you helped me a lot.

TRS