Jump to content

TCPTimeout


Xand3r
 Share

Recommended Posts

Is TCPTimeout supposed to apply to TCPConnect too?

If so than why does this show 20 seconds for me?

TCPStartup()
#include <GUIConstants.au3>
Opt('TCPTimeout' , 100)
GUICreate('')
GUISetState()
$start = TimerInit()
$x=TCPConnect('86.55.211.38' , 65001)
MsgBox(0 ,@error ,"Socket: " & $x & @CRLF & "Time: " & Round(TimerDiff($start)/1000,2) & " seconds")
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            TCPShutdown()
            Exit
    EndSelect
WEnd

I setup firewall so that it drops any attempt to connect to 65001 so in theory TCPConnect should take about 100 ms to report a failure right?

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

  • 3 months later...

Opt("TCPTimeout",10)

Global $out_txt

TCPStartup()
$iBeginTime = TimerInit()

$socket = TCPConnect("192.168.1.18", 8080)
If $socket <> -1 Then
    $out_txt = "Connect Successful! time-consuming: " & Round(TimerDiff($iBeginTime) / 1000, 4) & "sec"
Else
    $out_txt = "Connect Failed! time-consuming: " & Round(TimerDiff($iBeginTime) / 1000, 4) & "sec"
EndIf
TCPCloseSocket($socket)

ConsoleWrite($out_txt & @CRLF)
MsgBox(0, "", $out_txt)

The result: Connect Failed! time-consuming: 20.9968sec

Expo 2010 Shanghai China中国2010年上海世博会

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...