title: I have a "could not connect to host" Logcat message while trying to connect to FTP server, what am I doing wrong?
body: <p>I'm developing an application on Android that connects to a FTP server to upload and download files. To make the connection I'm using the apache commons-net library's FTPClient class based on <a href="http://androiddev.orkitra.com/?p=28" rel="nofollow">this</a> and I'm working on Eclipse.</p>
  
  <p>But I get the following message on my Logcat:</p>
  
  <pre><code>07-04 21:11:44.196: D/USB Virtual(14708): Error: could not connect to host ftp://xxx.xxx
  </code></pre>
  
  <p>The following is my manifest permissions:</p>
  
  <pre><code>&lt;uses-sdk android:minSdkVersion="7" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  </code></pre>
  
  <p>I'm really lost as to why I can't connect to my FTP server, in the console there're no errors showing. Am I missing something? I would thank any help.</p>
  
  <p>I'm adding the code I'm using to connect to my FTP server:</p>
  
  <pre><code>public boolean ftpConnect(String host, String username, String password,
          int port) {
      try {
          mFTPClient = new FTPClient();
                      //host is ftp://looner-project.zxq.net
          mFTPClient.connect(host);
          mFTPClient.connect(InetAddress.getByName(host));
  
  
          if (FTPReply.isPositiveCompletion(mFTPClient.getReplyCode())) {
  
              boolean status = mFTPClient.login(username, password);
              mFTPClient.setFileType(FTP.BINARY_FILE_TYPE);
              mFTPClient.enterLocalPassiveMode();
  
              return status;
          }
      } catch (Exception e) {
          Log.d(TAG, "Error: could not connect to host " + host);
      }
  
      return false;
  }
  </code></pre>