Jump to content

Connecting to a certain port


 Share

Recommended Posts

I am trying to see if a program communicating on port 27015 at my IP address, using the _getip function

TCPStartup()
$starttime = TimerInit()
$PublicIP = _GetIP()

If TimerDiff($starttime) >= $checkerror1 Then
    $socket = TCPConnect($PublicIP, 27015)
    If $socket = -1 Then
        $msgbox = MsgBox(4,"Error", "Server crashed, restart?", 10)
        If $msgbox = 6 or $msgbox = -1 Then
            $as_Body = "  Server:Server Crashed, Attempting Restart"
    ;_logfile()
    ;_smscheck()
    ;_RestartServer()
        ElseIf $msgbox = 7 Then
            Exit
        EndIf
    EndIf
    TCPCloseSocket($socket)
    $starttime = TimerInit()
;$checkerror1 = GUICtrlRead($checkerror) * 1000
EndIf

But the problem is, it works sometimes, and at others, it doesn't work, and restarts the server even though it is still up. Any clue to what I am doing wrong? I can provide the whole source code if you PM me.

Edited by Coolw
My ProgramsMy WIP'sSteam Server Restarter
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...