title: FTPClient hangs up in middle of of transfer and never times out
body: <p>I have a simple FTP upload App that normally works fine.</p>
  
  <p>Sometimes in the middle of a Upload I might lose INTERNET (moving between wifi spots or something).</p>
  
  <p>When this happens the Upload keeps trying to upload but makes no progress, doesn't timeout or cause any errors and since the service never finishes I can't restart it unless I force stop the App.</p>
  
  <p>How can I set timeout options and any other useful tool prevent my App from doing this?</p>
  
  <p>How do I implement and to what effect the following or any other:</p>
  
  <pre><code>client.setConnectTimeout(60); //Are this milliseconds, seconds or what?
  client.setDefaultTimeout(300); //Are this milliseconds, seconds or what?
  client.setControlKeepAliveTimeout(120); //Are this milliseconds, seconds or what?
  </code></pre>
  
  <p>Here is a shoetened version of my code for you to see.</p>
  
  <p>myFTP.class</p>
  
  <pre><code>public class myFTP{
      String ip;
      String user;
      String pass;
      FTPClient client = new FTPClient();
  
      public myFTP() {
          ip = "someip";
          user = "´someuser";
          pass = "somepass";
          client = new FTPClient();
      }
  
      public boolean connect() {
          //Define vars
          try{
              //Connect and login
              client.setConnectTimeout(60);
              client.setDefaultTimeout(300);
              client.setControlKeepAliveTimeout(120);
              client.connect(ip);
              client.login(user,pass);
  
              if(FTPReply.isPositiveCompletion(client.getReplyCode())){
                  client.setFileType(FTP.BINARY_FILE_TYPE);
              }else{
                  Log.e ("Coneccion FTP", "Fallo");
              }
  
          } catch (UnknownHostException e) {
              e.printStackTrace();
              return false;
          } catch (SocketException e){
              e.printStackTrace();
              return false;
          } catch (IOException e) {
              e.printStackTrace();
              return false;
          }
          return true;
      }
  
      public boolean upload (String fileName, File file, String dir){
  
          //Cargo el archivo
          try{
              FileInputStream fis = new FileInputStream(file);
              client.enterLocalPassiveMode();
              Log.e("Subiendo", fileName);
              boolean status = client.storeFile(dir+fileName,fis);
              if (!status){
                  fis.close();
                  return false;
              }
              fis.close();
          } catch (FileNotFoundException e) {
              e.printStackTrace();
              return false;
          } catch (IOException e) {
              e.printStackTrace();
              return false;
          }
          try {
              client.disconnect();
          } catch (IOException e) {
              e.printStackTrace();
          }
          return true;
      }
  }
  </code></pre>