Created
October 27, 2017 13:09
-
-
Save aoirint/bb591b3a55e67561c9bad384876f1552 to your computer and use it in GitHub Desktop.
UDP2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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