Closed jeremydouglass closed 4 years ago
I think this does the job:
import processing.net.*;
Client myClient;
int dataIn;
void setup() {
size(200, 200);
myClient = new Client(this, "127.0.0.1", 5204);
noLoop();
}
void draw() {
background(dataIn);
}
// ClientEvent message is generated when the server
// sends data to an existing client.
void clientEvent(Client someClient) {
print("Server Says: ");
dataIn = someClient.read();
println(dataIn);
redraw();
}
Issue description
The Network library
clientEvent()
example incorrectly attempts drawing outsidedraw()
. This causes elements to fail to render. See previous discussion:https://github.com/processing/processing/issues/5992#issuecomment-596142827
URL(s) of affected page(s)
https://processing.org/reference/libraries/net/clientEvent_.html
Proposed fix
The example should be updated, moving all drawing from
clientEvent()
todraw()
.