LogServer can only accept one connection at a time, therefore we should not initialize the LogServerClient multiple times to access it from different classes / modules.
Instead, declare it as a Public Process_Global and initialize the LogServerClient in your Main module, then access it from Main in other modules you want to use it from.
If like me, you want to save typing, declare it as a Private Global in the module you want to access it from, and in the initialize sub of the class, or before you first access it in a module, assign the Public variable from Main to the Private Global in the module.
In Main :
In other modules :
Instead, declare it as a Public Process_Global and initialize the LogServerClient in your Main module, then access it from Main in other modules you want to use it from.
B4X:
Main.LS.Message("Send Message")
If like me, you want to save typing, declare it as a Private Global in the module you want to access it from, and in the initialize sub of the class, or before you first access it in a module, assign the Public variable from Main to the Private Global in the module.
In Main :
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
'Create a Global variable to point to the LogServerClient
Public LS As LogServerClient
.
.
.End Sub
In other modules :
B4X:
Sub Class_Globals
Private fx As JFX
Private LS As LogServerClient
End Sub
Public Sub Initialize
LS = Main.LS
.
.
.
End Sub