processing/processing
Network library examples work in 3.4, but broken in Processing 3.5.4/4.0a3
Geschlossen
#6.166 geöffnet am 08.03.2021
help wanted
Repository-Metriken
- Stars
- (6.431 Sterne)
- PR-Merge-Metriken
- (Keine gemergten PRs in 30 T)
Beschreibung
Description
I wrote the following simple_server.pde and simple_client.pde using "processing.net.*;" but their behaviors seem to be strange. The simple_client.pde seems to receive "Hi" and "Yes". Am I missing something?
// simple_server
import processing.net.*;
Server svr;
void setup() {
svr = new Server(this, 5555);
size(450, 255);
}
void draw() {
Client c = svr.available();
if (c != null) {
String s = c.readString(); // 読み込む
println(s);
svr.write("Yes");
}
}
// simple_client
import processing.net.*;
Client c;
void setup() {
c = new Client(this,"127.0.0.1", 5555);
size(450, 255);
}
void draw() {
if (c.available() > 0){
String s = c.readString();
println(s);
}
}
void mouseClicked() {
c.write("Hi");
}
Expected Behavior
"Hi" should be displayed in the console of the simple_server and "Yes" should be in the console of the simple_client. Processing 3.4 has this behavior but Processing 3.5 (4.0a3) doesn't.
Current Behavior
Both "Hi" and "Yes" are displayed in the console of the simple_client.
Steps to Reproduce
- Execute the simple_server.
- Execute the simple_client.
- Click the simple_clinet window.
Your Environment
- Processing version: Processing 3.5.4 (4.0a3)
- Operating System and OS version: Windows 10 Pro, version 2004, build, 19041.804
- Other information: Processing 3.4 seems to behave as expected.