Run these two apps at the same time starting with the Server.
Server:
import processing.net.*;
Server myServer;
byte outputValue = 0;
void setup() {
size(200, 200);
myServer = new Server(this, 5204);
}
void draw() {
outputValue += 4;
myServer.write(outputValue);
}
Client:
import processing.net.*;
Client myClient;
int dataIn;
void setup() {
size(200, 200);
myClient = new Client(this, "127.0.0.1", 5204);
}
void draw() {
if (myClient.available() > 0) {
dataIn = myClient.read();
println(dataIn);
}
}