'Activity module
Sub Process_Globals
Dim ClientSocket As Socket
Dim AStream As AsyncStreams '
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Display")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Close_Click
If ClientSocket.Connected Then
Astream.Close
ClientSocket.Close
End If
End Sub
Sub Connect_Click
If Not(ClientSocket.IsInitialized) Then
ClientSocket.Initialize("ClientSocket")
End If
ClientSocket.Connect("192.168.154.85", 2101, 2000)
End Sub
Sub ClientSocket_Connected (Successful As Boolean)
If Successful Then
AStream.Initialize(ClientSocket.InputStream,
ClientSocket.OutputStream, "AStreams")
ToastMessageShow("Successfully connected", True)
Else
ToastMessageShow("No connection!", True)
End If
End Sub
Sub AStreams_NewData (Buffer() As Byte)
Dim msg As String
msg = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
ToastMessageShow(msg, False)
Log(msg)
End Sub