TCPNameToIP
转换互联网名称为 IP 地址.
TCPNameToIP ( name )
参数
返回值
成功:
|
返回包含 IP 地址对应名称的字符串.
|
失败:
|
返回 "", @error 设置 为非 0 值.
|
@error:
|
为 windows API WSAGetError 的返回值. (请查阅 MSDN).
|
备注
TCPStartup() 必须在前面调用.
相关
TCPStartup
函数示例
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Start the TCP service.
TCPStartup()
; Register OnAutoItExit to be called when the script is closed.
OnAutoItExitRegister("OnAutoItExit")
; Assign a Local variable the IP address of www.autoitscript.com.
Local $sIPAddress = TCPNameToIP("www.autoitscript.com")
; If an error occurred display the error code and return False.
If @error Then
MsgBox($MB_SYSTEMMODAL, "", "Error code: " & @error)
Return False
Else
; Display the IP address.
MsgBox($MB_SYSTEMMODAL, "", "Domain name to IP :" & $sIPAddress)
EndIf
EndFunc ;==>Example
Func OnAutoItExit()
TCPShutdown() ; Close the TCP service.
EndFunc ;==>OnAutoItExit
----------------------------------------
|