commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Johnson <chach...@gmail.com>
Subject Re: Commons/Net Documentation
Date Mon, 09 Jan 2006 21:54:15 GMT
I've made some progress. I can now log into the server... but instead of
transferring the file (C:\builds\wsdl\AmazonWebServices.wsdl), it creates a
0 length file with the name "C:\builds\wsdl\AmazonWebServices.wsdl"

hmmm wth am i missing?
//Code:
ftpServer.user(ftpUser);
ftpServer.pass(ftpUser);
ftpServer.cwd(directory); //testDirectory
ftpServer.stor(wsdlLocation); // wsdlLocation =
"C:\builds\wsdl\AmazonWebServices.wsdl"

Thanks,
Dave

On 1/9/06, David Johnson <chachany@gmail.com> wrote:
>
> Hi there
>
> I'm trying to find basic documentation for the Commons/Net package, and
> both links that I see here http://jakarta.apache.org/commons/net/ are
> rather unhelpful.
>
> What I'm trying to do is fairly straigtforward
>
> 1. Connect to a known FTP server
> 2. Login to said FTP server using known userid and password
> 3. set the transfer type to ASCII
> 4. Transfer a file (whose location I have) to a subdirectory (/uploadTest)
>
> 5. close the connection
> 6. do allapproriate error checking.
>
> I dont see that sort of basic information in the JavaDocs..
>
> what I have so far is
>
> FTPClient ftpServer=new FTPClient();
> FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
> ftpServer.configure(conf);
>
> boolean error = false;
> try {
>     int reply;
>
>     ftpServer.connect(commonLocation);
>     System.out.println("Connected to " + commonLocation + ".");
>     System.out.print(ftpServer.getReplyString());
>
>     reply = ftpServer.getReplyCode();
>
>     if(!FTPReply.isPositiveCompletion(reply)) {
>         ftpServer.disconnect();
>         System.err.println("Error -- FTP server refused connection.");
>     }
>
>     ftpServer.login(ftpUser, ftpPass);
>     // Set the transfer type
>     // Chenge directories
>     // transfer file
>
>     ftpServer.logout();
> } catch(IOException e) {
>     error = true;
>     e.printStackTrace();
> } finally {
>     if(ftpServer.isConnected()) {
>         try {
>             ftpServer.disconnect();
>         } catch(IOException ioe) {
>             // do nothing
>         }
>     }
> }
>
> where can I go to get this info?
>
> --
> -Dave
> ChaChaNY@Gmail.com




--
-Dave
ChaChaNY@Gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message