Sign in to follow this  
Followers 0

TCPTimeout Bug?

3 posts in this topic

#1 ·  Posted

I've been playing with TCPTimeout and noticed something peculiar.

Perhaps someone has reported it before, but I couldn't find it.

A timeout of 1 to 999 is good with no problems.

A timeout of 1000 and higher causes the GUI to be sluggish.

If you keep going up to 2000, 3000, 4000, etc. -- it will be exponentially sluggish.

2 Questions:

What is happening between 999 and 1000 to cause this?

Is this a Windows problem or AutoIt?

The test script below, serves to reproduce the problem. (tested on 2 machines)

TCPStartup()
;
Local $Socket, $Server = TCPListen('127.0.0.1', 80)
If $Server = -1 Then Exit
;
Opt('TCPTimeout', 999); <-- change this to reproduce the problem
;
Local $gui = GUICreate('TCPTimeout Test', 400, 250, -1, -1)
GUISetState(@SW_SHOW)
;
While 1
    Switch GUIGetMsg()
        Case -3
            TCPShutdown()
            GUIDelete($gui)
            Exit
    EndSwitch
    ;
    $Socket = TCPAccept($Server)
    If $Socket <> -1 Then
        TCPCloseSocket($Socket)
    EndIf
WEnd
;

I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

Share this post


Link to post
Share on other sites



#2 ·  Posted

That's kinda neat in some fucked up way. Try changing the timeout with a timer and you'll see how it goes wrong

$iTimer = TimerInit()
    $Socket = TCPAccept($Server)
    ConsoleWrite(TimerDiff($iTimer) & @LF)

I don't know why this happens.

Share this post


Link to post
Share on other sites

#3 ·  Posted

Ah, that is very interesting. Thanks for confirming.

As long as TCPTimeout is 999 and below, the poll is at ~10ms.

When TCPTimeout is at 1000, then the poll is at ~1000ms.

And so on:

TCPTimeout:2000 = poll at ~2000ms

TCPTimeout:3000 = poll at ~3000ms

It appears to be a sleep in between polls that starts at 1000. (which is not the intended behavior of a timeout)


I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!

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  
Followers 0