Check the Socket Status, if the working in Background

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
Helo,

I want that my socket stays connected to the server continuously, and therefore I use this sub routine

B4X:
Sub TimerService_Tick    'TimerInterval = 5 sec
If Socket2.Connected = False Then
Socket2.Close
Socket2.Initialize("Socket2")
Socket2.Connect("xxxxxxxxxxxxx",xxxx,5000)      
Else
SendCommand("MSA" & TextStr)
End If
End Sub

the problem is that,if the app works in background, the socket checking doesn’t function
B4X:
If Socket2.Connected = False Then

as soon as the App works in foreground , socket checking functions without any Problem

could someone please explain me what i do wrong here?

greet
sinan
 

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
Helo Erel,

I don't understand what you mean.
Can you give me a example of this function?

greet
sinan
 
Upvote 0
Top