hi everyone !
how can i check if Client Network is disconnected from server ?
how can i check if Client Network is disconnected from server ?
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Public srv As Socket
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Public Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
srv.Initialize("srv")
srv.Connect("192.168.1.3",5563,3000)
End Sub
Sub srv_Connected (Successful As Boolean)
If (Successful = True) Then
Log("connected")
Label1.Text = "Connected"
End If
End Sub
'---------------------------------------------------------------
'Like this function !! check when connection is closed by server or internet fail
Sub srv_Disconnected (Successful As Boolean)
Log("connection lost")
Label1.Text = "Disconnected"
End If
End Sub
' -------------------------------------------------
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub