Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Serversocket1 As ServerSocket
Dim Socket1 As Socket
Dim Timer1 As Timer
Dim input1 As InputStream
Dim output1 As OutputStream
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.
Dim Button1 As Button
Dim Button2 As Button
Dim ListView1 As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
Button1.Text = "Connect"
Button2.Text = "Close"
Listview1.Clear
Socket1.Initialize("Socket1")
End Sub
Sub Activity_Resume
'Socket1.Listen
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
Timer1.Enabled = False
Socket1.Close
ServerSocket1.Close
End If
End Sub
Sub Button1_Click
If Socket1.IsInitialized = True Then
Socket1.Connect("192.168.178.33", 6832, 0)
If Socket1.Connected = True Then
Msgbox("Connected", "Info")
End If
End If
End Sub
Sub Button2_Click
If Socket1.Connected = True Then
Socket1.Close
End If
End Sub
Sub Socket1_Connected
End Sub
Sub Socket1_NewConnection(Successfull As Boolean, NewSocket As Socket)
Dim text As String
'Dim Buffer(100) As Byte
If Successfull Then
text = Socket1.OutputStream
' text = BytesToString(Buffer, 0, 100, "UTF-8")
Listview1.AddSingleLine(text)
End If
End Sub