jrmm Posted February 1, 2006 Posted February 1, 2006 Hello...... I am trying to use the ping function in autoit to determine if a networked device is online or not. If the ping times out without a response, the results are predictable, but if the network switch responds and tells me the destination is unreachable, then autoit seems to use that response as a successful ping. In the example below, the first ping that timed out, autoit sees as offline, but the responses from the switch (Reply from 172.25.11.254: Destination host unreachable.) show as online. Any ideas??? Thanks so much for any help, John Ping Example from DOS..... ping 172.25.28.117 Pinging 172.25.28.117 with 32 bytes of data: Request timed out. Reply from 172.25.11.254: Destination host unreachable. Reply from 172.25.11.254: Destination host unreachable. Reply from 172.25.11.254: Destination host unreachable. Ping statistics for 172.25.28.117: Packets: Sent = 4, Received = 3, Lost = 1 (25% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
Developers Jos Posted February 1, 2006 Developers Posted February 1, 2006 (edited) Are you testing the @error after the ping ?RemarksWhen the function fails (returns 0) @error contains extended information: 1 = Host is offline 2 = Host is unreachable 3 = Bad destination 4 = Other errors Edited February 1, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
flaxcrack Posted February 1, 2006 Posted February 1, 2006 Have you thought about incrasing the timeout in your script? [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
jrmm Posted February 2, 2006 Author Posted February 2, 2006 Are you testing the @error after the ping ?Thanks for the response. Yes, I check the @error and if the network switch responds that the IP address is unreachable, then the @error = 0 (online), when the device is actually OFFLINE.
jrmm Posted February 2, 2006 Author Posted February 2, 2006 Have you thought about incrasing the timeout in your script?Thanks for the response. When I increase the timeout, I get the same results. Autoit is just counting the (fail) response from the network switch thinking the device is online when it is not.
Holger Posted February 2, 2006 Posted February 2, 2006 (edited) @jrmm: what Autoit-version you are using? Cause I did a small change in the beta version you could try this. It should set @Error now to 4. You can find the beta-infos in the Developers-section of the forum. Edited February 2, 2006 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
flaxcrack Posted February 2, 2006 Posted February 2, 2006 Thanks for the response. When I increase the timeout, I get the same results. Autoit is just counting the (fail) response from the network switch thinking the device is online when it is not.Maybe you can use a RunWait() on the PING DOS command and then use StdoutRead() to analyze if the recieved packets are greater than 0. that is the only work around I can think of. [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
blademonkey Posted February 2, 2006 Posted February 2, 2006 Maybe you can use a RunWait() on the PING DOS command and then use StdoutRead() to analyze if the recieved packets are greater than 0. that is the only work around I can think of.I have found that ping isn't always the best indicator of wether a Machine is networked properly.Sometimes our servers will hang up on some random service driving the CPU usage to 99% and killing network connections.Although you can ping the PC at the time, it's network file serving functions cease to exist.I created a script that maps to each of our servers. Mapping is a better simulation of actual network tasks than just a ping (and even so, some Servers have ICMP disabled, even internally).just my $0.02.-Blademonkey ---"Educate the Mind, Make Savage the Body" -Mao Tse Tung
jrmm Posted February 2, 2006 Author Posted February 2, 2006 @jrmm: what Autoit-version you are using?Cause I did a small change in the beta version you could try this.It should set @Error now to 4.You can find the beta-infos in the Developers-section of the forum.Thanks so much for the idea.I was using Autoit 3.1.1. After running v3.1.1.106 (beta) things seem to work the way I would like.Thank you, Thank you, Thank you.
jrmm Posted February 2, 2006 Author Posted February 2, 2006 I have found that ping isn't always the best indicator of wether a Machine is networked properly.Sometimes our servers will hang up on some random service driving the CPU usage to 99% and killing network connections.Although you can ping the PC at the time, it's network file serving functions cease to exist.I created a script that maps to each of our servers. Mapping is a better simulation of actual network tasks than just a ping (and even so, some Servers have ICMP disabled, even internally).just my $0.02.-BlademonkeyThanks so much for the idea and very good point.I have to try it out.John
jrmm Posted February 2, 2006 Author Posted February 2, 2006 Maybe you can use a RunWait() on the PING DOS command and then use StdoutRead() to analyze if the recieved packets are greater than 0. that is the only work around I can think of.Thanks for the ideas. I'll try it.
flaxcrack Posted February 2, 2006 Posted February 2, 2006 I have found that ping isn't always the best indicator of wether a Machine is networked properly.Sometimes our servers will hang up on some random service driving the CPU usage to 99% and killing network connections.Although you can ping the PC at the time, it's network file serving functions cease to exist.I created a script that maps to each of our servers. Mapping is a better simulation of actual network tasks than just a ping (and even so, some Servers have ICMP disabled, even internally).just my $0.02.-BlademonkeyI agree. Or what if you take into consideration that the server or remote PC may have a firewall that does not allow echo request. You will indeed get a time out. Maybe the solution here would be using a TCP server/client with AutoIT. [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
jrmm Posted February 2, 2006 Author Posted February 2, 2006 I agree. Or what if you take into consideration that the server or remote PC may have a firewall that does not allow echo request. You will indeed get a time out. Maybe the solution here would be using a TCP server/client with AutoIT. I'm not sure I could pull it off. Thanks so much for the ideas. I'm fairly new to AutoIt, but love it.
flaxcrack Posted February 2, 2006 Posted February 2, 2006 I'm not sure I could pull it off. Thanks so much for the ideas. I'm fairly new to AutoIt, but love it.I'll help you pull it off. Put your code in here and I will help you convert it. And that way you can learn in the process. [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
jrmm Posted February 2, 2006 Author Posted February 2, 2006 I'll help you pull it off. Put your code in here and I will help you convert it. And that way you can learn in the process. Gosh.... thank you so much for the offer. Let me clean the script up a bit so it is more understandable. I'll get back with you.
flaxcrack Posted February 2, 2006 Posted February 2, 2006 Gosh.... thank you so much for the offer. Let me clean the script up a bit so it is more understandable. I'll get back with you.Sure thing. I'll need something to work on tommorw any ways. [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
jrmm Posted February 2, 2006 Author Posted February 2, 2006 Sure thing. I'll need something to work on tommorw any ways. I'm including the GUI script. It's not complete yet, but the ping portion of it is what we are having trouble at this point. The purpose of this script is to go through printers in the printers folder and check to see if they are online.... the change the comments for the printer. You are welcome to look at this script, but don't put a big importance on it. It's just something I'm trying to figure out. I comented out the Start / Resume button's functions because it sends commands to your PC and I didn't want to mess something up. John
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