import java.io.*; import java.net.*; class server implements Runnable { Thread thread; ServerSocket serverSocket = null; Socket clientSocket = null; int connects = 0; int portti; boolean running; public void start(int portti) { this.portti = portti; thread = new Thread(this); thread.start(); running = true; } public void run() { while(running) { try { // Create the server socket serverSocket = new ServerSocket(portti, 5); while (connects < 5) { // Wait for a connection System.out.println("Waiting..."); clientSocket = serverSocket.accept(); //Service the connection service(clientSocket); connects++; } serverSocket.close(); } catch (IOException ioe) { System.out.println("Error in SimpleWebServer: " + ioe); } } } public void stop() { connects = 100; running = false; } public static void service(Socket client) throws IOException { BufferedReader inbound = null; DataOutputStream outbound = null; try { // The streams for input and output inbound = new BufferedReader( new InputStreamReader(client.getInputStream())); outbound = new DataOutputStream( client.getOutputStream()); // This is the output StringBuffer buffer = new StringBuffer( "