Sign in to follow this  
Followers 0
mbkowns

How to really set a TCPConnect timeout.

3 posts in this topic

If I connect to a IP with TCPConnect( $g_IP, 80 ) and use a IP that went down or doesn't exist in DNS it has a huge delay for a response.

How can I make this faster?

I have tried setting with zero effect.

Opt("TCPTimeout",10)

$g_IP = "10.82.1.37"
Opt("TCPTimeout",10)

$time = @HOUR & ":" & @MIN & ":" & @SEC

; Start The TCP Services
;==============================================
TCPStartUp()

; Connect to a Listening "SOCKET"
;==============================================
$socket = TCPConnect( $g_IP, 80 )


msgbox(4096, "", $socket & @CR & "START: " & $time & @CR & "End: " & @HOUR & ":" & @MIN & ":" & @SEC) 

TCPShutdown()

Share this post


Link to post
Share on other sites



Well, The only thing I can think of is to make 2 scripts...

(pseudo code, don't just copy+paste)

Script 1:

CODE

#NoTrayIcon

TCPStartup()

TCPConnection($myip, 80)

Func OnExit()

TCPShutdown()

EndFunc

Script 2:

CODE

$check = Run "Script 1"

sleep(500) ; Wait for as long as you want

if ProcessExists($check) Then

ProcessClose($check)

MsgBox(0, "Error", "Server is down")

EndIf

; Do your stuff

...

Let us know how that works... also, if someone has a less hacky way, please share with us :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0