Sub Process_Globals
Dim socket As ServerSocket
Dim astream As AsyncStreams
End Sub
Sub start
socket.Initialize(80,"socket")
socket.Listen
Log("jHueBridge Ready!")
End Sub
Sub Socket_NewConnection (Successful As Boolean, NewSocket As Socket)
If Successful Then
astream.Initialize(NewSocket.InputStream,NewSocket.OutputStream,"astreams")
End If
End Sub
Sub astreams_NewData (Buffer() As Byte)
Dim s As String = BytesToString(Buffer,0,Buffer.Length,"utf8")
Log(s)
Handle(s)
End Sub
Sub Handle(msg As String)
If msg.Contains("description.xml") Then
astream.Write(descriptionXML.GetBytes("utf8"))
End If
end sub