title: Access FTP sever from android app
body: <p>I can't access "ftp server in PC" from "android app" to download file, I used wireless connection.</p>
  
  <pre><code>public void FTP_Download(){
  
              String server = "192.168.1.135";
              int port = 21;
              String user = "pc1";
              String pass = "1551";
  
              FTPClient ftpClient = new FTPClient();
  
              try {
  
                  ftpClient.connect(server, port);
                  ftpClient.login(user, pass);
                  ftpClient.enterLocalPassiveMode();
                  ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
                  Toast.makeText(getBaseContext(), "download starting.",Toast.LENGTH_LONG).show();
                  // APPROACH #1: using retrieveFile(String, OutputStream)
                  String remoteFile1 = "i.xml";
                  File downloadFile1 = new File("sdcard/i.xml");
  
                  OutputStream outputStream1 = new BufferedOutputStream(new FileOutputStream(downloadFile1));
                  boolean success = ftpClient.retrieveFile(remoteFile1, outputStream1);
                  outputStream1.close();
  
                  if (success) {
                      Toast.makeText(getBaseContext(), "File #1 has been downloaded successfully.",Toast.LENGTH_LONG).show();
                  }
  
              } catch (IOException ex) {
                  System.out.println("Error: " + ex.getMessage());
                  ex.printStackTrace();
              } finally {
                  try {
                      if (ftpClient.isConnected()) {
                          ftpClient.logout();
                          ftpClient.disconnect();
                      }
                  } catch (IOException ex) {
                      ex.printStackTrace();
                  }
              }
  
  
  
  
  
  }
  </code></pre>
  
  <p>I added internet permission :</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  </code></pre>
  
  <p>Note: I tested app in emulator on PC and all things was OK.</p>
  
  <p>When I tried to access FTP from default browser I can't, but I can from firefox.</p>
  
  <p>any help please</p>