Sub Process_Globals
Private astream As AsyncStreams
Private server As ServerSocket
End Sub
Sub AppStart (Args() As String)
server.Initialize(51042, "server") 'make sure that firewall allows incoming connections.
server.Listen
StartMessageLoop
End Sub
Sub server_NewConnection (Successful As Boolean, NewSocket As Socket)
Log("new connection")
astream.InitializePrefix(NewSocket.InputStream, False, NewSocket.OutputStream, "Astream")
End Sub
Sub Astream_NewData (Buffer() As Byte)
Log(BytesToString(Buffer, 0, Buffer.Length, "UTF8"))
astream.Write("test".GetBytes("utf8"))
End Sub