views:

45

answers:

2

Hi,

I wrote a simple WebServer using HttpListener class (.net 2.0)

It seems that It doesn't work on port other then 80.

When i sniff the transport to my server i can see the Syn packets on Port 8080 arrive to the server, but there is no Syn/Ack response, although when i sue netstat -a i can see that the server is listening to port 8080 (i verified that my application is the one that listens)

HttpListener server = new HttpListener()
server.Prefixes.Add("http://192.168.4.133:8080/");
server.Start();
_log.Write("Waiting for a connection... ");
HttpListenerContext context = server.GetContext();
HttpListenerRequest request = context.Request;
HttpListenerResponse response = context.Response;
_log.Write("Got request for " + request.RawUrl);

the above code doesn't receive any Context (stuck at the line server.GetContext()) if i change the Prefix to "http://192.168.4.133/" the above code works perfectly.

when i am testing it on Port 80, i am killing the IIS services, and making sure that my application is the one that listen to the relevant port.

i am running this on XP, so i don't think it is security issues....but you never know.. i have read about the httpcfg tool, but didnt really understood it...

is there something inherntly diffrent between listening on port 80 to listening on other ports? 8080 or even better another random user port? Thanks, Itay

+1  A: 

Check if you're firewall is on or off and if on, whether prohibiting this port access. You can termorarily turn it of for the test just to make sure.

Side note: No need to be hunting down and killing IIS processes, simply stop the IIS windows service (run the command "services.msc" to see a list)

Nikolaos
Regarding the IIS, that is what i ment. i stopped the IISAdmin service.
Itay Levin
It was the FW, Thanks.
Itay Levin
+2  A: 

I'd suggest checking your firewall, and if you don't find anything -- try to run another server on 8080 and check if it's working (so you know that it's the port, not the server).

Mewp
regarding the FW, i don't understand - if i can sniff it? how is it possible that it is blocked by the FW? or the FW is sitting after the sniffer?
Itay Levin
I guess the sniffer is before the FW. It is fixed now! :) It's working.
Itay Levin