Click here to Skip to main content

A.J Bosch asked:

Open original thread
Hi there I need Urgent help please I am trying to connect to a FTP server but it bombs out at
mFTPClient = new FTPClient();
 
with this error when I mouse over FTPClient();
Quote:
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.

 
I Have downloaded the library file for
import org.apache.commons.net.ftp.*;
From http://commons.apache.org/net/download_net.cgi[^]
 
The full connection method is
 
public boolean ftpConnect(String host, String username,String password, int port){
 
                try {
                 mFTPClient = new FTPClient();
                 // connecting to the host
                 mFTPClient.connect(host, port);
 
                 // now check the reply code, if positive mean connection success
                 if (FTPReply.isPositiveCompletion(mFTPClient.getReplyCode())) {
                     // login using username & password
                     boolean status = mFTPClient.login(username, password);
 
                     /* Set File Transfer Mode
                      *
                      * To avoid corruption issue you must specified a correct
                      * transfer mode, such as ASCII_FILE_TYPE, BINARY_FILE_TYPE,
                      * EBCDIC_FILE_TYPE .etc. Here, I use BINARY_FILE_TYPE
                      * for transferring text, image, and compressed files.
                      */
                     mFTPClient.setFileType(FTP.BINARY_FILE_TYPE);
                     mFTPClient.enterLocalPassiveMode();
                     Toast.makeText(getBaseContext(),"Connected!!",Toast.LENGTH_LONG).show();
                     return status;
                 }
             } catch(Exception e) {
                 Toast.makeText(getBaseContext(),"failed "+e+"/r/n Could not connect to"+host,Toast.LENGTH_LONG).show();
             }
 
             return false;
            }
 
please as I am still new to android and java development ANY help would be appreciated
 
The toast's are just for device test that I am able to see where it succeeds and where it fails
 
Kind Regards
A.J Bosch
Tags: Java, Android, Apache, Eclipse, FTP

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web03 | 2.8.150129.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100