Check if internet connection is up..... 
Author Message
 Check if internet connection is up.....

I want a script that will check if my internet connection is up and running
(I'm on a LAN). I think I should just ping a couple of popular sites and if
I get replies then I assume that the network is up and running. How would I
capture the output of the Ping command? is there any other way to do this?
        -J

P:\>ping altavista.com

Pinging altavista.com [209.73.164.96] with 32 bytes of data:

Reply from 209.73.164.96: bytes=32 time=110ms TTL=239
Reply from 209.73.164.96: bytes=32 time=101ms TTL=239
Reply from 209.73.164.96: bytes=32 time=100ms TTL=239
Reply from 209.73.164.96: bytes=32 time=100ms TTL=239

Ping statistics for 209.73.164.96:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 100ms, Maximum =  110ms, Average =  102ms



Sun, 01 Feb 2004 04:20:34 GMT  
 Check if internet connection is up.....
Hi

TIP1: Before asking questions that most likely has been asked before, do a
newsgroup search.
You can use http://groups.google.com/advanced_group_search to search in a news
database having articles dated back to all the way to 1995.

TIP2: When you have the Google search results in a browser window, drag and
drop each thread (the link that says "View Thread" in a ANOTHER browser window.
This way you don't have to wait for the search result to be reloaded each time
you have looked at a thread.

For your question:

Fill in the following words in the "Find messages with all of the words"
field:  get ping output

Fill in *scripting in the Newsgroup field to narrow down the search to the
scripting groups only!

Then read and learn :-)

Regards,
Torgeir

Quote:

> I want a script that will check if my internet connection is up and running
> (I'm on a LAN). I think I should just ping a couple of popular sites and if
> I get replies then I assume that the network is up and running. How would I
> capture the output of the Ping command? is there any other way to do this?
>         -J

> P:\>ping altavista.com

> Pinging altavista.com [209.73.164.96] with 32 bytes of data:

> Reply from 209.73.164.96: bytes=32 time=110ms TTL=239
> Reply from 209.73.164.96: bytes=32 time=101ms TTL=239
> Reply from 209.73.164.96: bytes=32 time=100ms TTL=239
> Reply from 209.73.164.96: bytes=32 time=100ms TTL=239

> Ping statistics for 209.73.164.96:
>     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
> Approximate round trip times in milli-seconds:
>     Minimum = 100ms, Maximum =  110ms, Average =  102ms



Sun, 01 Feb 2004 04:36:09 GMT  
 Check if internet connection is up.....
There are many API functions available to check whether a connection
to the Internet is available or not. Here are some: InternetAttemptConnect,
InternetCheckConnection, InternetGetConnectedState, IsDestinationReachable,
IsNetworkAlive, ...
Information about these functions can be found in our API list
(http://www.allapi.net/api/apilist.php)

Regards,
Pieter Philippaerts
http://www.allapi.net/


Quote:
> I want a script that will check if my internet connection is up and
running
> (I'm on a LAN). I think I should just ping a couple of popular sites and
if
> I get replies then I assume that the network is up and running. How would
I
> capture the output of the Ping command? is there any other way to do this?
>         -J

> P:\>ping altavista.com

> Pinging altavista.com [209.73.164.96] with 32 bytes of data:

> Reply from 209.73.164.96: bytes=32 time=110ms TTL=239
> Reply from 209.73.164.96: bytes=32 time=101ms TTL=239
> Reply from 209.73.164.96: bytes=32 time=100ms TTL=239
> Reply from 209.73.164.96: bytes=32 time=100ms TTL=239

> Ping statistics for 209.73.164.96:
>     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
> Approximate round trip times in milli-seconds:
>     Minimum = 100ms, Maximum =  110ms, Average =  102ms



Sun, 01 Feb 2004 07:35:52 GMT  
 Check if internet connection is up.....
Hi

try this

P:\>ping altavista.com >c:\temp.txt

Now you can use the script to read an display the output in the way you like


Quote:
> I want a script that will check if my internet connection is up and
running
> (I'm on a LAN). I think I should just ping a couple of popular sites and
if
> I get replies then I assume that the network is up and running. How would
I
> capture the output of the Ping command? is there any other way to do this?
>         -J

> P:\>ping altavista.com

> Pinging altavista.com [209.73.164.96] with 32 bytes of data:

> Reply from 209.73.164.96: bytes=32 time=110ms TTL=239
> Reply from 209.73.164.96: bytes=32 time=101ms TTL=239
> Reply from 209.73.164.96: bytes=32 time=100ms TTL=239
> Reply from 209.73.164.96: bytes=32 time=100ms TTL=239

> Ping statistics for 209.73.164.96:
>     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
> Approximate round trip times in milli-seconds:
>     Minimum = 100ms, Maximum =  110ms, Average =  102ms



Sun, 01 Feb 2004 12:34:52 GMT  
 Check if internet connection is up.....
I use the following function, which returns a boolean for me:

Function PingOK(strMachine)
    Dim objPingLog, WSHShell
    Dim ShellRun, strPingSuccess(1), intPingSuccess(1), blnPingOK
    'Defaults to True
    blnPingOK = True
    Set WSHShell = CreateObject("WScript.Shell")
    ShellRun = WSHShell.Run("cmd /c ping -n 2 " & strMachine & " >
pinglog.txt", 0, True)
    Set objPingLog = fso.OpenTextFile("pinglog.txt", 1, False)
    strPingSuccess(0) = objPingLog.ReadLine
    If Left(strPingSuccess(0), 12) = "Unknown host" Then
        blnPingOK = False
    Else
        objPingLog.SkipLine
        objPingLog.SkipLine
        strPingSuccess(0) = objPingLog.ReadLine
        strPingSuccess(1) = objPingLog.ReadLine
        intPingSuccess(0) = InStr(strPingSuccess(0), "Request timed out.")
        intPingSuccess(1) = InStr(strPingSuccess(1), "Request timed out.")
        If (intPingSuccess(0) <> 0) And (intPingSuccess(1) <> 0) Then
            blnPingOK = False
        End If
        intPingSuccess(0) = InStr(strPingSuccess(0), "Destination net
unreachable.")
        intPingSuccess(1) = InStr(strPingSuccess(1), "Destination net
unreachable.")
        If (intPingSuccess(0) <> 0) And (intPingSuccess(1) <> 0) Then
            blnPingOK = False
        End If
    End If
    objPingLog.Close
    PingOK = blnPingOK
End Function

The fso variable is a global-defined file system object that I use in nearly
all of my scripts....  I can use this function in If...Then...Else
statements to determine if a machine/website is up & running.
If PingOK(your_site) Then
    ' Do some stuff here
Else
    ' Do some other stuff
End If

Hope this helps!

        -Rob Shaw-Fuller

Quote:

> Hi

> try this

> P:\>ping altavista.com >c:\temp.txt

> Now you can use the script to read an display the output in the way you
like



> > I want a script that will check if my internet connection is up and
> running
> > (I'm on a LAN). I think I should just ping a couple of popular sites and
> if
> > I get replies then I assume that the network is up and running. How
would
> I
> > capture the output of the Ping command? is there any other way to do
this?
> >         -J

> > P:\>ping altavista.com

> > Pinging altavista.com [209.73.164.96] with 32 bytes of data:

> > Reply from 209.73.164.96: bytes=32 time=110ms TTL=239
> > Reply from 209.73.164.96: bytes=32 time=101ms TTL=239
> > Reply from 209.73.164.96: bytes=32 time=100ms TTL=239
> > Reply from 209.73.164.96: bytes=32 time=100ms TTL=239

> > Ping statistics for 209.73.164.96:
> >     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
> > Approximate round trip times in milli-seconds:
> >     Minimum = 100ms, Maximum =  110ms, Average =  102ms



Sun, 01 Feb 2004 20:22:16 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Javascripts for checking internet connection

2. Checking Internet Connection or URL existance

3. Checking internet connection and Scripting

4. Checking internet connection www/ftp (Torgeir?)

5. Checking internet connection

6. Checking for the presence of an Internet connection.

7. Check if internet connection is up.....

8. checking internet connection from .net

9. Check Internet Connection

10. Checking for client internet connection.

11. Advanced: CHECK for Internet Connection

12. Checking an Internet Connection

 

 
Powered by phpBB® Forum Software