Sign in to follow this  
Followers 0
jrmm

Ping Results not predictable

17 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Are you testing the @error after the ping ?

Remarks

When the function fails (returns 0) @error contains extended information:

1 = Host is offline

2 = Host is unreachable

3 = Bad destination

4 = Other errors

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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()

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Holger

Share this post


Link to post
Share on other sites

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()

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

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

Thanks so much for the idea and very good point.

I have to try it out.

John

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

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.


[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()

Share this post


Link to post
Share on other sites

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.

:lmao: I'm not sure I could pull it off. Thanks so much for the ideas. I'm fairly new to AutoIt, but love it.

Share this post


Link to post
Share on other sites

o:) 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. :lmao:


[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()

Share this post


Link to post
Share on other sites

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. :lmao:

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.

Share this post


Link to post
Share on other sites

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. :lmao:


[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()

Share this post


Link to post
Share on other sites

Sure thing. I'll need something to work on tommorw any ways. o:)

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.

:lmao: 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 ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0