Need to check Port 80 using C [Archive] - C Board

PDA

View Full Version : Need to check Port 80 using C


PaperDoylie
03-31-2008, 09:11 AM
Hiya there

I need to write a command line app that checks if Port 80 is ope for http requests or blocked. IF its blocked it would be good to be able to output what is blocking it (NOrton or another firewall for example) but this is not totally needed.

If anyone has any ideas, snippets, that would be great!

Thanks

djnorthyy
03-31-2008, 03:56 PM
Dunno if this helps? I haven't read it through....

http://tangentsoft.net/wskfaq/articles/lame-list.html

brewbuck
03-31-2008, 04:21 PM
Does nmap not suffice for this need?

PaperDoylie
04-01-2008, 03:52 AM
Hi

Thanks for the posts above. The winsocks stuff isn't really what I was after.

The NMAP tool does exactly what I need to be honest, except for two issue (there are always issues!)

1) it requires a user to install Winpcap (this has got to be more straightforward than that) and
2) The output is deemed to confusting for the client!

Any other ideas??

Andy

rags_to_riches
04-01-2008, 05:26 AM
Any other ideas??

Andy

cURL (http://curl.haxx.se)?

PaperDoylie
04-01-2008, 07:55 AM
Yeah I download cURL, spent a while looking at it and got a bit lost to be honest.

I have also found

http://www.nirsoft.net/utils/cports.html

Which is good and the Microsoft tool

http://www.petri.co.il/quickly_find_remote_open_ports.htm

does something similar.

WOuld have liked to write it myself but time is off the essense!

39ster
04-01-2008, 09:47 PM
-Create a socket
-Set the socket to non-blocking
-Call the connect function (it should return immediately)
-Use select with a timeout of 5 seconds. If there is a connection on port 80, select should return 1 WITHIN 5 seconds. If there is no connection, than select should return 0 AFTER 5 seconds.
-Close socket.

PaperDoylie
04-03-2008, 05:51 AM
In the end I did it in VS2005 using C++ not C.

IF anyone wants to see the project the please ask