title: java server send printstream to port 80 or 443
body: <p>I have a file transfer applet, and I am at the moment creating a logging system, so in the applet as it initialized, until it send file and finish will start printing a log file (originally it goes to java console on the client side) but now I'm modifying it so it will go to the server instead (create a file in the server and start writing on the file). </p>
  
  <p>It working now, I'm using port 5000, but I need to open the firewall for port 5000 since opening port is dangerous, can I just use port 80 or 443 (HTTPS) since it open anyway for file transfer? how to do it?</p>
  
  <p>example of the code at the moment is</p>
  
  <p>in java applet there will be</p>
  
  <pre><code>handler = new SocketHandler("xxx.xxx.xxx.xx", 5000);
  //on different area of the file there will be something like
  log("starting the applet");
  log("sending email");
  ...
  </code></pre>
  
  <p>while on the server I create a simple java server like this</p>
  
  <pre><code>public class ThreadedEchoServer {
      // using port 5000 
      static final int PORT = 5000;
  
      public static void main(String args[]) {
          ServerSocket serverSocket = null;
          Socket socket = null;
  
          try {
              serverSocket = new ServerSocket(PORT);
          } catch (IOException e) {
              e.printStackTrace();
  
          }
          while (true) {
              try {
                  socket = serverSocket.accept();
              } catch (IOException e) {
                  System.out.println("I/O error: " + e);
              }
  
              // new thread for a client
              new EchoThread(socket).start();
          }
      }
  }
  </code></pre>