int port = 9000; for (int i = 0; i < data.length; i++) data[i] = (byte) i; ServerSocket server = new ServerSocket(port); while (true) { Socket socket = server.accept(); Thread stuffer = new StuffThread(socket); stuffer.start(); }