Jump to content
Sign in to follow this  
hunt

Ping timeout problem

Recommended Posts

hunt

Hello. I have a problem: when internet is offline then the following example is not working as it should:

$Timeout = 1000
$host = "google.com"
$begin = TimerInit()
Ping($host,$Timeout)
MsgBox(0,"",TimerDiff($begin)) ; <-- shows ~2500ms; must ~1000ms

Share this post


Link to post
Share on other sites
omikron48

Why should it work if the net connection is down?

You are pinging google.com. Of course it won't succeed if you're not connected to the internet...

Edited by omikron48

Share this post


Link to post
Share on other sites
martin

Hello. I have a problem: when internet is offline then the following example is not working as it should:

$Timeout = 1000
$host = "google.com"
$begin = TimerInit()
Ping($host,$Timeout)
MsgBox(0,"",TimerDiff($begin)) ; <-- shows ~2500ms; must ~1000ms

I don't get that problem, but I agree that it should not give 2500. If I am offline I get various times up to 60 mS, and if I'm on line up to 200mS.

@Omikron48 - I think you misunderstood.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
omikron48

Oh. So what your after is the timeout consistency...

Well, I can't help test it now since I'm in the middle of transferring files.

Share this post


Link to post
Share on other sites
martin

Oh. So what your after is the timeout consistency...

Well, I can't help test it now since I'm in the middle of transferring files.

No. If you specify a maximum timeout of 1000 then you don't expect it to wait 2500. But if I try ping from the command prompt and specify a timeout of 1000 mS it takes a lot longer than 1 second the first time I try. SO probably it isn't an AutoIt problem.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
omikron48

When I try pinging a non-existent IP address in my network, I get a timediff of 1060ms to 1600ms, which seems reasonable since there's bound to be extra processing being done by the function other than the ping timing out itself.

BTW, my processor is an Intel Core 2 Duo E6320 @ 1.86GHz.

Share this post


Link to post
Share on other sites
martin

When I try pinging a non-existent IP address in my network, I get a timediff of 1060ms to 1600ms, which seems reasonable since there's bound to be extra processing being done by the function other than the ping timing out itself.

BTW, my processor is an Intel Core 2 Duo E6320 @ 1.86GHz.

The point of the thread is not the time variation. The point is that if you specify a maximum timeout then you would expect that if no answer was received by that time then ping would terminate and not wait any longer. So if you specify 1000mS why does it return with a time that is longer than that sometimes?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.