Jump to content

gui freezes on tcpconect


Recommended Posts

Hello

when I try to do a tcp conection to an Ip that is online but with a closed port, my gui freezes, is there a way arround that I could check if the port is not active or a way to avoid the freezing??

I leave you with an example code

thanks

AdlibRegister("_500", 500)
AdlibRegister("_1000", 1000)
$gui = GUICreate("test",200,100,-1,-1)
$connect = GUICtrlCreateButton("connect", 10, 10, 50, 18)
GUISetState(@SW_SHOW,$gui)
while 1
    $gMsg = GUIGetMsg()
    Switch $gMsg
        case -3
            Exit
        Case $connect
            ConsoleWrite("TCPConnect"&@LF)
            TCPStartup()
            $Socket = TCPConnect("192.168.1.6", '5000' )
            ConsoleWrite ("$Socket= "&$Socket&@lf)
            TCPShutdown()
    EndSwitch
WEnd
func _500()
    ConsoleWrite("!500"&@LF)
EndFunc
func _1000()
    ConsoleWrite("-1000"&@LF)
EndFunc

 

Link to comment
Share on other sites

You could use my socket UDF. There is a function called _TCPConnect() with a timeout parameter.

http://www.autoit.de/index.php?page=Attachment&attachmentID=24567&h=ca64bd1c55936912df877c3045756d05bda42374

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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...