Jump to content

Pre-Bug Report: Ping Time out Parameters


SmOke_N
 Share

Recommended Posts

  • Moderators

I commented on this topic: http://www.autoitscript.com/forum/index.ph...369&hl=Ping a while back, and explained on why the timeout param in Ping() could take an additional 14 milliseconds, with the use of additional function calls. That all makes sense, however.. tonight, after making a function with InternetGetConnectedState to check for an internet connection, it was reporting connection true (at the moment, I haven't debugged it much, so I am not sure why) if I turned off my cable modem.

So as a back up, I decided to use Ping() with a 250 millisecond timeout param, and use google/yahoo/msn as 3 extra checks.

Well, I found with the script below, my modem turned off, that it took over 17 seconds regardless of what I set the timeout parameter to, for Ping to fail.

$nTime = TimerInit()
$bPing = Ping('www.google.com', 250)
$nDiff = TimerDiff($nTime) / 1000
ConsoleWrite(@LF & _
    'Time = ' & $nDiff & @LF & _
    'Ping = ' & $bPing & @LF)

Results with internet disconnected - Running:(AutoIt 3.2.2.0) - Windows XP Pro SP2:

Test 1 = @ 1 Millisecond

Time = 17.2625853285823 Seconds to time out

Ping = 0

Test 2 = @ 250 Millisecond

Time = 17.307389067605 Seconds to time out

Ping = 0

Test 3 = @ Default (4000 milliseconds)

Time = 17.3088040519116 Seconds to time out

Ping = 0

The question is... Is this by design to do so if there is no internet connection, or is there an issue specifically with the timeout option?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Well, I found with the script below, my modem turned off, that it took over 17 seconds regardless of what I set the timeout parameter to, for Ping to fail.

...

Results with internet disconnected - Running:(AutoIt 3.2.2.0) - Windows XP Pro SP2:

The question is... Is this by design to do so if there is no internet connection, or is there an issue specifically with the timeout option?

as your modem was switched off, your system was not able to resolve the IP addresses via DNS. I guess, that's the reason for the delay... Test it with the IP addresses of google/yahoo/etc. to see if that changes anything.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

  • Moderators

as your modem was switched off, your system was not able to resolve the IP addresses via DNS. I guess, that's the reason for the delay... Test it with the IP addresses of google/yahoo/etc. to see if that changes anything.

Cheers

Kurt

Thanks for that :) ... That did correct the issue, wish I'd have thought of that last night and or it have been suggested in the help file.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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