Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

TCPTimeout Bug?


  • Please log in to reply
2 replies to this topic

#1 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 17 February 2012 - 11:31 AM

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)

AutoIt         
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!







#2 AdmiralClaws

AdmiralClaws

    Here be dragons

  • Active Members
  • PipPipPipPipPipPip
  • 4,649 posts

Posted 17 February 2012 - 09:52 PM

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.

#3 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 704 posts

Posted 18 February 2012 - 12:56 AM

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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users