We are about to switch to a new forum software. Until then we have removed the registration on this forum.
code:
import processing.net.*;
Client myClient;
String inString;
byte interesting = 10;
void setup() {
size (300, 100);
myClient = new Client(this, "127.0.0.1", 12345);
}
void draw() {
if (myClient.available() > 0) {
background(0);
inString = myClient.readStringUntil(interesting);
println(inString);
if (inString.equals("hello") == true) { // -this not working...
exit();
}
} else {
background(0,25,59);
}
}
and server:
import processing.net.*;
Server s;
Client c;
String input;
int data[];
void setup() {
size(450, 255);
background(204);
s = new Server(this, 12345);
}
void draw() {
if (mousePressed == true) {
s.write("hello\n");
}
}
Answers
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
https://Processing.org/reference/String_equals_.html
Not working..
Please edit your post and format your code. Then people can help you.
https://forum.processing.org/two/discussion/15473/readme-how-to-format-code-and-text
I edit text :) finish..
Your code worked on my machine with no changes. Don't forget to generate the mouse event in your server sketch.
Kf
Čech ? :D kfrajer ono to má zkontrolovat ten text odeslaný na klienta a mělo by to se shodovat a vypsat to že se to shoduje
("It is to check the text sent to the client and it should match and list that it matches").
Je pravda, co říkáte. Podivej
Server posila "hello\n" and you get exactly that.
inString = myClient.readStringUntil(interesting);
does not remove the ENTER character. You can make it work by changing your client like this:if (inString.equals("hello\n") == true) {...
nebo
Poznámka: Mluvím pomalu a trochu... a je ne rozumin dobre :( Pana, Překladač google je vyborne^
Měj se hezky!
Kf
Díky moc :) thank u :D
Thank kfrajer very very much :) its working very well :o