Function Reference


Ping

Pings a host and returns the roundtrip-time.

Ping ( "address/hostname" [, timeout = 4000] )

Parameters

address/hostname Can be i.e. "www.autoitscript.com" or "87.106.244.38".
timeout [optional] Is the time to wait for an answer in milliseconds (default is 4000).

Return Value

Success: the roundtrip-time in milliseconds ( greater than 0 ).
Failure: 0 if host is not pingable or other network errors occurred and sets the @error flag to non-zero.
@error: 1 = Host is offline
2 = Host is unreachable
3 = Bad destination
4 = Other errors

Example

#include <MsgBoxConstants.au3>
Example()
Func  Example()
; Ping the AutoIt website with a timeout of 250ms.
Local $iPing= Ping ("autoitscript.com",250)
If $iPingThen ; If a value greater than 0 was returned then display the following message.
MsgBox ($MB_SYSTEMMODAL,"","The roundtrip-time took: "&$iPing&"ms.")
Else
MsgBox ($MB_SYSTEMMODAL,"","An error occurred with @error value of: "&@error )
EndIf
EndFunc ;==>Example

AltStyle によって変換されたページ (->オリジナル) /