Sub Process_Globals
Private server As ServerSocket
Private astream As AsyncStreams
End Sub
Sub AppStart (Args() As String)
server.Initialize(61042, "server")
server.Listen
StartMessageLoop
End Sub
Sub server_NewConnection (Successful As Boolean, NewSocket As Socket)
If Successful Then
astream.Initialize(NewSocket.InputStream, NewSocket.OutputStream, "AsyncStream")
End If
server.Listen
End Sub
Sub AsyncStream_NewData (Buffer() As Byte)
Log(BytesToString(Buffer, 0, Buffer.Length, "utf8"))
astream.Write("received!".GetBytes("utf8"))
End Sub
Sub AsyncStream_Terminated
Log("astream_Terminated")
End Sub
Sub AsyncStream_Error()
Log("astream_Error")
End Sub