Function Reference


Ping

Pings a host and returns the roundtrip-time.

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

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: Returns the roundtrip-time in milliseconds ( greater than 0 ).
Failure: Returns 0 if host is not pingable or other network errors occurred and sets @error. (See Remarks)

Remarks

When the function fails (returns 0) @error contains extended information:
 1 = Host is offline
 2 = Host is unreachable
 3 = Bad destination
 4 = Other errors

Related

None.

Example


Local $var = Ping("www.AutoItScript.com", 250)
If $var Then; also possible:  If @error = 0 Then ...
    MsgBox(0, "Status", "Online, roundtrip was:" & $var)
Else
    MsgBox(0, "Status", "An error occured with number: " & @error)
EndIf