Results 1 to 9 of 9

Thread: Best way to check for internet connection?

  1. #1

    Thread Starter
    Hyperactive Member greg_quinn's Avatar
    Join Date
    Nov 2002
    Location
    South Africa
    Posts
    366

    Question Best way to check for internet connection?

    I have 2 sets of code that check for an internet connection, one does an httprequest, the other an sends an ICMP packet and and monitors the response...



    Was just wondering, taking into consideration firewalls and other security settings, if we install our web application on a company's premises, what is the best method for us to determine if an internet connection is available?



    Would using one of the above methods be ok, or is there a better method?



    Greg

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  3. #3
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Looks good Pirate. There is a VB example here .
    This world is not my home. I'm just passing through.

  4. #4

    Thread Starter
    Hyperactive Member greg_quinn's Avatar
    Join Date
    Nov 2002
    Location
    South Africa
    Posts
    366
    Thanks guys,

    But what kind of connection is used here?

    My main worry is an Administrator blocking ports, or httprequests, is there any way and Administrator can lock the above scripts from determining a connection?

  5. #5
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    I've tried running some code based on the link I gave you on my desktop and a test PC here at work.

    The desktop has an Internet connection through the company network and the code recognised that it was connected through a LAN. When I pulled out the network cable and re-ran the code it still told me I was connected to the Internet through a LAN (although I'd already got a message on-screen telling me that I was disconnected from the network).

    The test PC is wired into the network, but doesn't have an Internet connection set up - if you try to launch IE it starts the connection wizard. However, this PC also reported that it was connnected to the Internet via a LAN.

    I guess the code just detects whether the PC is capable of connecting to the Internet - it doesn't check whether the LAN is capable or will allow connection.

    The above is just my experience. Maybe somebody else could come in with a bit more theory?
    This world is not my home. I'm just passing through.

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by greg_quinn
    Thanks guys,

    But what kind of connection is used here?

    My main worry is an Administrator blocking ports, or httprequests, is there any way and Administrator can lock the above scripts from determining a connection?
    Umm , could be . The best answer would make sense is to test it . You may need to check the ports if they're being opened if yes then continue check internet activity . If blocked , then you're isolated from the internet on that port .

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by trisuglow
    I've tried running some code based on the link I gave you on my desktop and a test PC here at work.

    The desktop has an Internet connection through the company network and the code recognised that it was connected through a LAN. When I pulled out the network cable and re-ran the code it still told me I was connected to the Internet through a LAN (although I'd already got a message on-screen telling me that I was disconnected from the network).

    The test PC is wired into the network, but doesn't have an Internet connection set up - if you try to launch IE it starts the connection wizard. However, this PC also reported that it was connnected to the Internet via a LAN.

    I guess the code just detects whether the PC is capable of connecting to the Internet - it doesn't check whether the LAN is capable or will allow connection.

    The above is just my experience. Maybe somebody else could come in with a bit more theory?
    That's weird . It maybe because of it reads the values from a file that gets updated after some interval like lphost.txt or something like that . Did you try it after some time of the first attempt ?

  8. #8
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Pirate.

    I disconnected the test PC from the network THEN switched it on and ran the connection-to-the-Internet test. It still said it was connected. I left it sitting for five minutes then tried again. Still connected.

    I searched the disk and there is no file called lphost.txt.

    What do you think about that?
    This world is not my home. I'm just passing through.

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    trisuglow ,
    The best way maybe is to ask for httprequest . I mean direct connecting to the internet , depending on the error raised , you firugre out if you're connected or no . I don't know exactly why it's acting like that though . And for the file , it's it ends with the word ' *host.* ' if not wrong .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width