Private Sub ConnectToServer(Host As String, hport As Int)
Do While working
Log("Trying to connect to: " & Host)
CloseExistingConnection
Dim client As Socket
client.Initialize("Client")
client.Connect(Host, hport, 10000)
'client.Connect("192.1.1.1", hport, 10000)
Wait For Client_Connected (Successful As Boolean)
If Successful Then
AST.Initialize(client.InputStream, client.OutputStream, "AST")
Log("IP - Successful Connect")
Do While working And client.Connected
Sleep(5000)
Loop
Else
Log("IP - Failed to connect: " & LastException)
End If
Sleep(5000)
Loop
End Sub