Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
If FirstTime Then
server.Initialize(5000, "server")
Log(server.GetMyWifiIP)
lblState.Text=server.GetMyWifiIP
server.Listen
End If
End Sub
Sub server_NewConnection (Successful As Boolean, NewSocket As Socket)
If Successful Then
If ast.IsInitialized Then ast.Close
ast.Initialize( Me, "ast", NewSocket.InputStream, NewSocket.OutputStream) 'initialize AsyncStreamsText with the socket streams.
Else
Log(LastException)
End If
server.Listen
End Sub
Sub ast_NewText(Text As String)
Log("Text: " & Text)
Log(Text.Length)
Dim information As StringBuilder
information.Initialize
information.Append("HTTP/1.1 200 OK")
information.Append("Date: Sat, 18 Apr 2020 13:41:56 GMT")
information.Append("server: App-webs/")
information.Append("Connection: close")
information.Append("Content-Length: 5951")
information.Append("Content-Type: Application/soap+xml; charset=utf-8")
If (Text.Contains("Host"))Then
ast.Write("HTTP/1.1 200 OK "& Chr(10) & Chr(13))
ast.Write("Date: Sat, 18 Apr 2020 13:41:56 GMT")
ast.Write("server: App-webs/")
ast.Write("Connection: close")
ast.Write("Content-Length: 500")
ast.Write("Content-Type:"&" text/html;charset=utf-8"&Chr(10) & Chr(13))
ast.Write("<html>helloword<html>"&Chr(10) & Chr(13))
Log("GET INFO")
End If
End Sub