1 // Copyright 2000-2005 the Contributors, as shown in the revision logs.
2 // Licensed under the Apache License 2.0 ("the License").
3 // You may not use this file except in compliance with the License.
9 import org.ibex.nestedvm.Runtime;
12 private static final int PORT = 2000;
13 public static void main(String[] args) throws Exception {
14 ServerSocket sock = new ServerSocket(PORT);
15 System.err.println("Listening on " + PORT);
16 for(;;) new Client(sock.accept()).go();
19 private static class Client implements Runnable {
21 public Client(Socket sock) { this.sock = sock; }
22 public void go() { new Thread(this).start(); }
25 Runtime task = (Runtime) Class.forName("tests.EchoHelper").newInstance();
29 task.addFD(new Runtime.InputOutputStreamFD(sock.getInputStream()));
30 task.addFD(new Runtime.InputOutputStreamFD(sock.getOutputStream()));
33 int status = task.run(new String[]{"EchoHelper"} );
34 System.err.println("Exit status: " + status);
35 } catch(Exception e) {
36 System.err.println(e);