I’ve written full example for using Java Sockets in Processing to communicate with a Lantronix XPort or any other TCP/IP enabled device.
The program:
- opens a Socket
- checks to see if data is available
- gets a byte of data from the remote device
- sends a byte of data to the remote device
- closes the streams of data and closes the Socket
Sockets are more flexible than Processing’s Net library, and are a great way to move anything from a primitive (like a byte) to an Object (like a PSound) between devices.