Sign in to follow this  
Followers 0
AdmiralAlkex

Ping is slow when Host is offline

2 posts in this topic

#1 ·  Posted (edited)

Even when you use the timeout parameter Ping() takes a minimum of ~500 ms on IP adresses without any device.

$iTimer = TimerInit()
For $iX = 1 To 10
    Ping("10.0.0.111", 100)
Next
ConsoleWrite(Round(TimerDiff($iTimer) / 10) & " ms average" & @LF)

471 ms average

Can anything be done to shorten this other than running multiple processes/threads?

Note that Windows own ping.exe is not any faster.

$iTimer = TimerInit()
For $iX = 1 To 10
RunWait("ping 10.0.0.111 -n 1 -w 100")
Next
ConsoleWrite(Round(TimerDiff($iTimer) / 10) & " ms average" & @LF)

454 ms average

Edited by AdmiralAlkex

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

  • Similar Content

    • hcI
      By hcI
      Hello everyone !
      While writing a sample of code to test ping to my internet box, I got stuck..
      While the code is Pinging with let say.. 5000ms of timeout, I need to update a progress bar from 0 to 5000 ms at the same time but I don't know how could I do this..
      Is there a way or something that could get around the pause of the ping like in InetGet -> InetGetInfo?
    • Fenzik
      By Fenzik
      Hello,
      my question is based on topic about Nvda Screen reader development atThis Link
      Autoit GUI is totaly nice for blind users, because it's controls are mostly standart.
      But in cooperation with Screen Readers this guis are much slower than other guis.
      Do you have any idea about reason of this behaviour?
      Thanks a lot for any answer.
      Fenzik
    • AlexFing17
      By AlexFing17
      i want a script that
      "on the beginning of the program it pings to check if there is internet connectivity.
      if there is internet connectivity
      then it executes my code
      else if there is no internet it waits at background to detected internet connectivity then executes my code."
       
      Is this possible

       
    • tk1
      By tk1
      Hello,
      Is there a way, preferably natively within AutoIt, to replicate:
      ping -i 2 <nearby_IP>
      The ping() function only has an option to set the timeout, but I want to set the TTL to 2 instead.
       
      Thanks,
      tk1
    • ur
      By ur
      I want to check whether machine is up or not after we poweron a VM.
      So to check that, I am using ping.
      With the below command, when we run it, it will capture the value success or not with the errorlevel.
      ping -n 1 sinra09-lod11 >nul: 2>nul: so we can track the return code back using below.
      echo %errorlevel% So it is able to return the 1 when it is failure and 0 when it is success.
       
      But when I convert the above commands to AutoIT, the return code is always giving 0 even on failure.
      MsgBox(0,pingCheck("sinra09-lod11"),"sinra09-lod11") Func pingCheck($system_name) ;$system_name = "sinra09-lod1" $command = @SystemDir&"\ping.exe -n 1 "& $system_name & " >nul: 2>nul:" ConsoleWrite($command) Local $iReturn = RunWait($command) ;MsgBox(0,$system_name,$iReturn) ConsoleWrite($iReturn) if $iReturn = 0 then Return True Else Return False EndIf EndFunc Please suggest..