Ping
向远程主机发送 Ping(查验) 命令,并返回往返时间.
Ping ( "address/hostname" [, timeout = 4000] )
参数
address/hostname
|
可以是 "www.autoitscript.com" 或 "87.106.244.38".
|
timeout
|
[可选] 等待响应的时间值(毫秒)(default(默认) = 4000).
|
返回值
成功:
|
返回往返的时间值(毫秒)(大于 0 ).
|
失败:
|
返回 0, 表示主机没有连通或发生其它网络错误, @error 设置 为非 0 值.
|
@error:
|
1 = 主机离线
|
函数示例
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Ping the AutoIt website with a timeout of 250ms.
Local $iPing = Ping("autoitscript.com", 250)
If $iPing Then ; 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
----------------------------------------
注释
在函数结束时的错误(返回0)@误包含扩展信息:
在офлайне
1 =主机
2 =主机不可用
3 =坏destination
4 =其他错误
该函数可以通过命令调用 exect
exect=$var_i=Ping('tc-image.3dn.ru',250)||_ViewValues('$var_i') ;; 以毫秒为单位返回延迟
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|