ripdad Posted February 17, 2012 Share Posted February 17, 2012 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 ; "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 More sharing options...
AdmiralAlkex Posted February 17, 2012 Share Posted February 17, 2012 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. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
ripdad Posted February 18, 2012 Author Share Posted February 18, 2012 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) "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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now