// Go into infinite loop, sending messages, receiving responses and
// processing them...
DataInputStream din = (DataInputStream)inStream;
DataOutputStream dout = (DataOutputStream)outStream;
while (true) {
String msg = nextMsg();
if (msg != null) {
String inMsg = "", inToken = "";
try {
dout.writeUTF(msg);
while (inToken.compareTo("END") != 0) {
inToken = din.readUTF();
inMsg = inMsg + " " + inToken;
}
processMsg(inMsg);
}
catch (Exception e) {}
}
}