1. 程式人生 > >[ 求指導 ] AutoIT TCPCONNECT函數如何支持IPV6

[ 求指導 ] AutoIT TCPCONNECT函數如何支持IPV6

nec 返回 com play you work http spl ipv

由於工具改造需要,AutoIt語言中如何實現TCPCONNECT函數支持IPV6。是否可以用Python/Java語言重寫函數使其返回值與原支持IPV4的TCPCONNECT函數相同滿足兼容性。當前TCPCONNECT函數僅支持IPV4。函數原型如下:

技術分享圖片

TCPCONNET函數示例如下:---湊夠150個字

#include <MsgBoxConstants.au3>

; I am the client, start me after the server! (Start first the TCPAccept example script).

Example()

Func Example()
    TCPStartup() ; Start the TCP service.

    ; Register OnAutoItExit to be called when the script is closed.
    OnAutoItExitRegister(
"OnAutoItExit") ; Assign Local variables the loopback IP Address and the Port. Local $sIPAddress = "127.0.0.1" ; This IP Address only works for testing on your own computer. Local $iPort = 65432 ; Port used for the connection. ; Assign a Local variable the socket and connect to a Listening socket with
the IP Address and Port specified. Local $iSocket = TCPConnect($sIPAddress, $iPort) ; If an error occurred display the error code and return False. If @error Then ; The server is probably offline/port is not opened on the server. Local $iError = @error MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND),
"", "Could not connect, Error code: " & $iError) Return False Else MsgBox($MB_SYSTEMMODAL, "", "Connection successful") EndIf ; Close the socket. TCPCloseSocket($iSocket) EndFunc ;==>Example Func OnAutoItExit() TCPShutdown() ; Close the TCP service. EndFunc ;==>OnAutoItExit

[ 求指導 ] AutoIT TCPCONNECT函數如何支持IPV6