jvds Posted July 6, 2014 Share Posted July 6, 2014 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 More sharing options...
NateF Posted July 7, 2014 Share Posted July 7, 2014 (edited) $test = Ping(192.168.1.6:5000) If $test = 0 then 0 = (no response) Edited July 7, 2014 by NateF Link to comment Share on other sites More sharing options...
funkey Posted July 7, 2014 Share Posted July 7, 2014 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 tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. 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