Jump to content

How to detect network is ON / OFF for Win2000 ?


Recommended Posts

I wonder how actually to detect if a network on Win2000 is ON / OFF

rather than using PING ??

Pls help.... :whistle:

Ping isn't a very reliable thing to use to determine if you have a network connection, unless you're pinging a source that you know will respond to a ping. Since responding to a ping is considered by many network administrators to be a security flaw, most of them turn ping responses off. The exception is on internal networks.

There is a lot of discussion (on this board and others) about detecting if a network is connected, which baffles me. The act of testing for a network connection and actually establishing a network connection are one in the same. If you need to get some data/file from a remote server, just try to establish the connection to the server and handle the connection failure when/if it happens.

Note: I'm not at all flaming your for asking this question. It's asked a lot and I'm just stumped about why people don't just make a connection and handle the possible error instead of "testing" for a connection before making a connection. :P

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

I use this in my script, I need to check for a connection as an application I'm installing will install but error at the end if there is no connection, I don't want to have to wait until the end of an install to find there is no connection and then have to go back and clean-up a part installed app.

Func PingChk ()
  RunWait(@ComSpec & " /c " & 'ping www.google.com -n 1 >> C:\Temp.txt', "", @SW_HIDE)

  $file = FileRead("C:\Temp.txt", FileGetSize("C:\Temp.txt"))

  If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
  Else 
        $find = StringInStr( $file, "Ping request could not find host www.google.com") 
      
     If $find = 0 Then
        FileDelete("C:\Temp.txt")
        Else
        Msgbox(0,"ERROR: No Internet Connection", "This computer is not connected to the Internet.")
        FileDelete("C:\Temp.txt")
     EndIf
  EndIf
EndFunc
Edited by saldous
Link to comment
Share on other sites

I use this in my script, I need to check for a connection as an application I'm installing will install but error at the end if there is no connection, I don't want to have to wait until the end of an install to find there is no connection and then have to go back and clean-up a part installed app.

I have a special procedure for programs that must phone home in order to install. It's called hitting the delete key. :whistle: Edited by PaulIA
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

what i actually wanted to do is....

checking all the time if a particular PC's network connection is down.

if the connection is down, it prompts out a message to the end-user.

Previously I found out an example... using DLLCall feature to call up .dll file (which I'm not familiar with).

Tested the example, it won't work if you unplug out the network cable, it still shows that the network is still up. :whistle:

This is to be used for internal network environment.... I actually need it to detect its network connectivity, then only perform

certain tasks depending on the network connectivity.

If possible, pls provide example.

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...