Sockets Example

eloutlet.jpg

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:

  1. opens a Socket
  2. checks to see if data is available
  3. gets a byte of data from the remote device
  4. sends a byte of data to the remote device
  5. 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.

Scroll to Top