m0nk3yI3unz Posted July 10, 2008 Posted July 10, 2008 Hey all. I dont usually need help, especially with the TCP functions (Ive used them a lot) but this one is stumping me... I have a script which pings the server I want it to connect to, and if it's there, to connect to it (even if the application it's trying to connect to isn't running - It's supposed to check for that). The TCPConnect function, when called, is either connect the first time, or kill the program - no loops. Problem is, the program is hanging up on that command. I need it to try once, then if it doesn't connect, to kill the app. My Code: w("TCP Services Started! Connecting to server...") setMsg("Connecting to update","server....","Started...") Global $Connect = TCPConnect($IP,$UPORT) switch $Connect case $Connect > 0 setMsg("Connected successfully.","Retriving token...") case -1 switch @error case 1 ; <================= ERROR NUM 501 msgbox(48,"ERROR","IP address of server is incorrect, or server is offline. Please try again later, or see site for details."&@CRLF&"ERROR NUM: 501") Exit case 2 ; <================= ERROR NUM 502 msgbox(48,"ERROR","Server port is incorrect, or server is offline. Please try again later, or see site for details."&@CRLF&"ERROR NUM: 502") Exit EndSwitch EndSwitch Monkeh.
Airwolf Posted July 10, 2008 Posted July 10, 2008 Have you tried setting TCPTimeout()? Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
m0nk3yI3unz Posted July 10, 2008 Author Posted July 10, 2008 I thought the default was 100 milliseconds muttley Lemme try it... Nope - still freezes. Monkeh.
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