Skip to content

Instantly share code, notes, and snippets.

@aoirint
Created October 27, 2017 13:09
Show Gist options
  • Save aoirint/bb591b3a55e67561c9bad384876f1552 to your computer and use it in GitHub Desktop.
Save aoirint/bb591b3a55e67561c9bad384876f1552 to your computer and use it in GitHub Desktop.
UDP2
import hypermedia.net.*;
UDP udp;
void setup() {
udp = new UDP(this, 31416, "127.0.0.1");
udp.setReceiveHandler("recv");
udp.listen(true);
}
void draw() {
}
void recv(byte[] data, String hostIP, int portNo) {
print("0x");
for (int i=0, len=data.length; i<len; i++) {
System.out.printf("%02X", data[i]);
}
println();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment