I'm trying to write a script that listens for broadcasted UDP packets on port 2088, read the data, and then POST to an URL. Specifically, I'm trying to make a LIFX light turn red when I'm on the phone. Whenever our phones change state (off-hook, on-hook, ringing, etc) it broadcasts its state on UDP 2088.
So, the pseudo-code would be something like:
Start Loop
Listen for UDP 2088 from source [my phone]
If data = [x] then send command to turn on lamp
else if data = [y] send command to turn off lamp
The biggest problem is I'm not sure how to actually grab the data from the packet. It is readable in Wireshark, but when I run, for example, netcat, I get output that is unreadable.
$ netcat -u -l 2088 -vv
Bound on 0.0.0.0 2088
Connection received on 192.168.250.51 2088
^C5
Thanks!