Public Sub Press(Action As String)
Dim uc As UDPSocket
udpClient = uc
udpClient.Initialize("PRESS", port, 8000)
Dim packet As UDPPacket
Log("Sending Action: " & Action)
Dim toSend As String : toSend = "POST /keypress/[KEY] HTTP/1.1\r\n\r\n".Replace("[KEY]", Action).Replace("\r\n", CRLF)
Log(toSend)
'Do a simple write
Dim sendBytes() As Byte : sendBytes = toSend.GetBytes("UTF8")
packet.Initialize(sendBytes, host, port)
udpClient.Send(packet)
End Sub
Sub PRESS_PacketArrived(Packet As UDPPacket)
Dim msg As String
msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8")
Log(msg)
End Sub