Jump to content
Sign in to follow this  
LoWang

ping function unrealiable

Recommended Posts

Hello, I made not very pleasant discovery...

#

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$p1=ping("9.17.137.11")
consolewrite("ping() result:"&$p1&" @error:"&@error&@crlf)
$p2=runwait('cmd.exe /c ping 9.17.137.11 -n 2')
consolewrite("cmd.exe ping result: "&$p2&" (0 means success)"&@CRLF)

The output is:

ping() result:0 @error:2

Pinging 9.17.137.11 with 32 bytes of data:
Reply from 9.17.137.11: bytes=32 time=176ms TTL=127
Reply from 9.17.137.11: bytes=32 time=219ms TTL=127

Ping statistics for 9.17.137.11:
    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 176ms, Maximum = 219ms, Average = 197ms
cmd.exe ping result: 0 (0 means success)

Why can't ping() ping it but cmd ping can? @error 2 means Host is unreachable. I need this in a virtual box virtual machine running on Linux VPNed to my work. I haven't tried it at work yet if it works with direct connection...

Edited by LoWang

Share this post


Link to post
Share on other sites

Perhaps AutoIt does not have permissions.

Make sure it is allowed internet access in any security software you are running.

Edited by JohnOne

Share this post


Link to post
Share on other sites

So now I am connected directly in the office and ping() works too...

ping() result:171 @error:0

Pinging 9.17.137.11 with 32 bytes of data:
Reply from 9.17.137.11: bytes=32 time=171ms TTL=127
Reply from 9.17.137.11: bytes=32 time=172ms TTL=127

Ping statistics for 9.17.137.11:
    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 171ms, Maximum = 172ms, Average = 171ms
cmd.exe ping result: 0 (0 means success)

 

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  

×
×
  • Create New...