5 import org.xwt.mips.Runtime;
8 private static final int PORT = 2000;
9 public static void main(String[] args) throws Exception {
10 ServerSocket sock = new ServerSocket(PORT);
11 System.err.println("Listening on " + PORT);
12 for(;;) new Client(sock.accept()).go();
15 private static class Client implements Runnable {
17 public Client(Socket sock) { this.sock = sock; }
18 public void go() { new Thread(this).start(); }
21 Runtime task = new EchoHelper();
22 int status = task.run(
23 new String[]{"EchoHelper"},
25 new Runtime.InputStreamFD(sock.getInputStream()),
26 new Runtime.OutputStreamFD(sock.getOutputStream()),
29 System.err.println("Exit status: " + status);
30 } catch(Exception e) {
31 System.err.println(e);