Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private server As ServerSocket
Private client As Socket
Private Astream As AsyncStreams
Public IsConnected As Boolean
Private tmr As Timer
Private lblState As Label
End Sub
'============================================================================================
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("LayoutServer")
MainForm.Title = "IPC Server"
MainForm.Show
listenForConnections
tmr.Initialize("tmr", 1000)
End Sub
'============================================================================================
private Sub listenForConnections
server.Initialize(17170, "server")
Log($"My ip is: ${server.GetMyIP}"$)
server.Listen
Wait for server_NewConnection(successful As Boolean, NewSocket As Socket)
Log("New Connection")
If successful Then
If Astream.IsInitialized Then
Astream.Close
End If
Astream.InitializePrefix(NewSocket.InputStream, True, NewSocket.OutputStream, "astream")
SetState(True)
End If
End Sub