Jump to content
Sign in to follow this  

TCPTimeout does not work or how to abort TCPConnect ...

Recommended Posts


i have some problems by using TCPConnect. i try to ping an ip + port, which works, but the answertime is really long (>20.000ms).

the TCPTimeout is normally set to 100ms, so i understand, if there is no answer within 100ms the TCPConnect should abort, but it does not do that. does anybody know, why?

because that is not working, i thought about a way to exit the TCPConnect-Function, but i need help. I add a timer to the script and with the adblib-function i´m able to check, if there is "no reply" in maybe 5000 ms. but how to interrupt now tcpconnect?

a little script for that:


$sock = ""
$iport = "8888"

Dim $Ip[2]
$Ip[0] = 1
$Ip[1] = ""

For $i = 1 To $Ip[0]
    $timer = TimerInit()
    $sock = TCPConnect($IP[$i], $iPort)
    If Not @error Then
            ConsoleWrite("OK " & $ip & @TAB & Round(TimerDiff($timer), 2) & @CRLF)
            ConsoleWrite("Fail " & $ip & @TAB & Round(TimerDiff($timer), 2) & @CRLF)

Share this post

Link to post
Share on other sites

Hmmm. never used any of the TCP functions

But at a wild guess I would try $sock = 0 to interrupt TCPConnect

Thanks for your reply. I already use "if @error" ... but that is called after the TCPConnect is fishised (after 20.000 ms), what is much to long. I want to interrupt TCPConnect before finishing, WHEN its longer thant 5000 ms.

Share this post

Link to post
Share on other sites

There is nothing you can do. There is no option to set for that. There is no hidden solution. There is nothing available in AutoIt that could help you. Don't even bother trying.

Eexcept for waiting.

...but you can wait with another process or, what is more advanced, in another thread.




Share this post

Link to post
Share on other sites

I feel like someone runs into this problem at least every week. Like trance said there is no solution based in autoit right now though I hope that there is some added functionality in future releases. Where can I request that sort of thing?

Anyway, here is my suggestion. Start using the winpcap based UDF here. Basically it gives you a ton more options when dealing with packet sending/capturing since it is all winpcap based. It is obviously a bit more complicated but if you are doing a port scanner it should give you all you need.

Share this post

Link to post
Share on other sites

Where can I request that sort of thing?

You have the link to the Issue Tracker at the top of the page (BugTracker), but a search for TCPConnect shows that there already is a ticket for it, #1310

Edit: Or you could just have pressed on the "Bug Reports and Feature Requests" forum. :(

Edited by AdmiralAlkex

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...