Function Reference

Ping

Pings a host and returns the roundtrip-time.

Ping ( address or hostname [, timeout] )

 

Parameters

address/hostname Can be i.e. "www.hiddensoft.com" or "178.50.76.4".
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 occured 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


$var = Ping("www.hiddensoft.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