Jump to content

TCPConnect Error Differences


ripdad
 Share

Recommended Posts

Reproducer...

TCPStartup()
;
TCPConnect('212.227.91.231', '80')
Local $error = @error
MsgBox(0, 'AutoIt Version: ' & @AutoItVersion, 'AutoIt Error: ' & $error & @CRLF & 'WSAError: ' & _WSAGetLastErrorEx() & @TAB)
TCPShutDown()
;
Func _WSAGetLastErrorEx()
    Local $a = DllCall('ws2_32.dll', 'int', 'WSAGetLastError')
    If @error Or Not IsArray($a) Then Return SetError(1, 0, 'FuncError -1')
    $a = DllCall('kernel32.dll', 'int', 'FormatMessage', 'int', 0x00001000, 'ptr', 0, 'int', $a[0], 'int', 0, 'str', 0, 'int', 2048, 'ptr', 0)
    If @error Or Not IsArray($a) Then Return SetError(1, 0, 'FuncError -2')
    Return $a[3] & ' - ' & StringStripWS($a[5], 7)
EndFunc

Tested: autoit-v3.3.12.0, autoit-v3.3.14.0 and autoit-v3.3.15.0 beta on Win7.

Seems to have started with autoit-v3.3.14.0.

image.png

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

I messed around with it some more -- and I suppose you don't have any choice but to use:

AutoItSetOption('TCPTimeout', 1000)

with the newer versions of Autoit -- which is fine.

I do think that the default value of 100ms needs to be set to at least 1000ms.

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...