public static void main(String[] args) {
      try {
           myURL=InetAddress.getLocalHost().getHostName();
      } catch (UnknownHostException e) {
           System.out.println("Unknown Host :" + e.toString());
           System.exit(1);
      }

      try {
           serverSocket = new ServerSocket(4000);
      } catch (IOException e) {
           System.out.println(myURL + ": could not listen on port: 4000, " + e.toString());
           System.exit(1);
      }
      System.out.println(myURL + ": EchoServer listening on port: 4000");

      try {
          boolean listening = true;
          while(listening){
            clientSocket = serverSocket.accept();
            is = new BufferedReader( new InputStreamReader(clientSocket.getInputStream()));
            os = new PrintWriter(clientSocket.getOutputStream());
            while ((inputline = is.readLine()) != null) {
            	 System.out.println(inputline);
                 os.println(eo.echo(inputline));
                 os.flush();
            }
          }

          os.close();
          is.close();
          clientSocket.close();
          serverSocket.close();
          
        } catch (IOException e) {
            System.err.println("Error sending/receiving" + e.getMessage());
            e.printStackTrace();
      }
    }