Need to check Port 80 using C

This is a discussion on Need to check Port 80 using C within the Networking/Device Communication forums, part of the General Programming Boards category; Hiya there I need to write a command line app that checks if Port 80 is ope for http requests ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    4

    Need to check Port 80 using C

    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

  2. #2
    Registered User
    Join Date
    Aug 2007
    Posts
    20
    Dunno if this helps? I haven't read it through....

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

  3. #3
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,235
    Does nmap not suffice for this need?

  4. #4
    Registered User
    Join Date
    Mar 2008
    Posts
    4

    Thanks for that

    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

  5. #5
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,648
    Quote Originally Posted by PaperDoylie View Post
    Any other ideas??

    Andy
    cURL?

  6. #6
    Registered User
    Join Date
    Mar 2008
    Posts
    4

    Thanks

    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_...open_ports.htm

    does something similar.

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

  7. #7
    Registered User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    217
    -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.

  8. #8
    Registered User
    Join Date
    Mar 2008
    Posts
    4

    Smile Thanks for all the responses

    In the end I did it in VS2005 using C++ not C.

    IF anyone wants to see the project the please ask

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. serial port to poll on request
    By infineonintern in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 06:52 AM
  3. Parallel Port IO ops not working properly
    By microtechno in forum Linux Programming
    Replies: 16
    Last Post: 06-08-2009, 12:33 PM
  4. MFC check box question
    By MyglyMP2 in forum Windows Programming
    Replies: 2
    Last Post: 03-09-2009, 05:47 PM
  5. connecting to server with wrong port
    By liri in forum Networking/Device Communication
    Replies: 3
    Last Post: 11-13-2007, 02:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21