All pastes #110487 Raw Edit

Client Code

public java v1 · immutable
·published 2006-08-01 18:38 UTC
rendered paste body
public String Request(String cmd) {                                                       char[] buf = {};        StringBuffer ret = new StringBuffer();                // send command to server        System.out.println("Client.Request(): Sending \"" + cmd + "\" to server...\n");        out.println(cmd);                try {              // wait for response from server              // HOW DO I ACTUALLY WAIT UNTIL RESPONSE, HOW DO I KNOW WHEN RESPONSE IS FINISHED?              in.read(buf, 0, buf.length);              System.out.println("Client.Request(): FromServer: " + buf.toString() + "\n");              ret.append(buf.toString());                                  } catch (IOException e) {            return e.toString();        }                        return ret.toString();    }