B4X:
Sub StartConnection As ResumableSub
Funzioni.ScriviLog("Trying to connect to: " & Funzioni.ip)
CloseExistingConnection
clientSocket.Initialize("clientSocket")
clientSocket.Connect(Funzioni.ip, Funzioni.port, 8000)
Wait For ClientSocket_Connected (Successful As Boolean)
If Successful Then
Funzioni.ScriviLog("Connect a " & Funzioni.ip)
'AStreams1.InitializePrefix(clientSocket.InputStream, False, clientSocket.OutputStream, "astreams1")
AStreams1.Initialize(clientSocket.InputStream, clientSocket.OutputStream, "astreams1")
Return True
Else
Funzioni.ScriviLog("Error Connection : " & LastException)
Return False
End If
End Sub
B4X:
dim c as Custom
c.Initialize
Wait For(c.StartConnection) Complete (Result As Boolean)
If Result = True Then
'go ahead with command execution
Else
'I have to repeat the sub StartConnection
End If
Hi, I have this sub which I then call this way, how do I repeat the command n times in case of a false result?