Post date: 2013/05/07 23:29:24
import processing.net.*;
Client c;
String data;
void setup() {
size(200, 200);
background(50);
fill(200);
c = new Client(this, "localhost", 10500); // connect to julius server }
void draw() {
if (c.available() > 0) { // if there's incoming data from the server...
data = c.readString(); // ...then grab it
int p1;
String str1="WORD=\"";
while((p1=data.indexOf(str1)) > 0) { // find str1
data=data.substring(p1+str1.length()); // pick the word ..
int p2=data.indexOf("\""); // .. to "
if(p2>0){
print(data.substring(0,p2)); // print WORD="XXXX"
data=data.substring(p2); // go to next
}
}
println();
}
}