import java.io.*; import java.net.*; public class ThreadEchoServer { public static void main(String[] args) { int i = 0; try { // port 8189 is chosen by the programmer ServerSocket s = new ServerSocket(8189); for (;;) { Socket incoming = s.accept(); i ++; System.out.println("Spawning " + i); ThreadEchoHandler t = new ThreadEchoHandler(incoming, i); t.start(); } } catch (Exception e) { System.out.println(e); } } // main } // ThreadEchoServer