friends Posted March 13, 2007 Posted March 13, 2007 I wonder how actually to detect if a network on Win2000 is ON / OFF rather than using PING ?? Pls help....
PaulIA Posted March 13, 2007 Posted March 13, 2007 I wonder how actually to detect if a network on Win2000 is ON / OFF rather than using PING ??Pls help.... 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. Auto3Lib: A library of over 1200 functions for AutoIt
saldous Posted March 13, 2007 Posted March 13, 2007 (edited) 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 March 13, 2007 by saldous
PaulIA Posted March 13, 2007 Posted March 13, 2007 (edited) 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. Edited March 13, 2007 by PaulIA Auto3Lib: A library of over 1200 functions for AutoIt
friends Posted March 21, 2007 Author Posted March 21, 2007 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. 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now