Skip to content

Instantly share code, notes, and snippets.

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