title: FTPClient - how to use active mode
body: <p>I made a small application that should upload files to an FTP server. The thing is that I used passive mode with the method   </p>
  
  <pre><code>enterLocalPassiveMode() 
  </code></pre>
  
  <p>Recently I was told that no passive mode is allowed on the FTP server, so I should make my application work in active mode. I suppose it couldn't be done by simply changing the method to  </p>
  
  <pre><code>enterLocalActiveMode()
  </code></pre>
  
  <p>What else should I change in the application to ensure it's working in active mode.</p>
  
  <p>Here's a code snippet which makes the connection to the server:  </p>
  
  <pre><code>public void connect() throws FTPException {
          try {
              ftpClient.connect(server, port);
              replyCode = ftpClient.getReplyCode();
              if (!FTPReply.isPositiveCompletion(replyCode)) {
  
                  printText("FTP server refused connection.");
                  throw new FTPException("FTP server refused connection.");
  
              }
              boolean logged = ftpClient.login(user, pass);
              if (!logged) {
                  ftpClient.disconnect();
                  printText("Could not login to the server.");
                  throw new FTPException("Could not login to the server.");
              }
  
              ftpClient.enterLocalPassiveMode();
  
          } catch (IOException ex) {
          printText("I/O errortest: " + ex.getMessage());
              throw new FTPException("I/O error: " + ex.getMessage());
          }
      }
  </code></pre>
  
  <p>Some guidance to what I have to change?</p>