Jump to content

TCPConnect Wont Die...


Recommended Posts

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.

Link to comment
Share on other sites

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