Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
Private tcps As ServerSocket
Private a As List
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private ListView1 As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
a.Initialize
tcps.Initialize(8099,"tcps")
tcps.Listen()
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
For i= 0 To a.Size-1
a.Get(i).As(AsyncStreams).Write("Hello".GetBytes("ASCII"))
Next
End Sub
Sub tcps_NewConnection (Successful As Boolean, NewSocket As Socket)
Dim x As AsyncStreams
x.Initialize(NewSocket.InputStream,NewSocket.OutputStream,"ass")
a.Add(x)
End Sub
Sub ass_NewData (Buffer() As Byte)
ListView1.AddSingleLine(BytesToString(Buffer,0,Buffer.Length,"ASCII"))
End Sub