Net library - application
in
Core Library Questions
•
2 years ago
Hi,
i was looking into the processing net library ( http://processing.org/reference/libraries/net/ )
and compiled the examples server and client
Server Code
Thanks in advance
i was looking into the processing net library ( http://processing.org/reference/libraries/net/ )
and compiled the examples server and client
Server Code
- import processing.net.*;
Server myServer;
int val = 0;
void setup() {
size(200, 200);
// Starts a myServer on port 5204
myServer = new Server(this, 5204);
}
void draw() {
val = (val + 2)%255;
background(val);
myServer.write(val);
}
- import processing.net.*;
Client myClient;
int dataIn;
void setup() {
size(200, 200);
// Connect to the local machine at port 5204.
// This example will not run if you haven't
// previously started a server on this port
myClient = new Client(this, "172.18.104.27", 5204);
}
void draw() {
if (myClient.available() > 0) {
dataIn = myClient.read();
}
background(dataIn);
}
Thanks in advance
1