5 import org.ibex.nestedvm.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 = (Runtime) Class.forName("tests.EchoHelper").newInstance();
25 task.addFD(new Runtime.InputOutputStreamFD(sock.getInputStream()));
26 task.addFD(new Runtime.InputOutputStreamFD(sock.getOutputStream()));
29 int status = task.run(new String[]{"EchoHelper"} );
30 System.err.println("Exit status: " + status);
31 } catch(Exception e) {
32 System.err.println(e);