Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

com.ibm.network.ftp

Status
Not open for further replies.

jovill

Instructor
Nov 1, 2001
2
0
0
CR
I am trying to implement an application which do an access via ftp
client to a ftp server.

I have the packages com.ibm.network.ftp, com.ibm.network.ftp.event,
com.ibm.network.ftp.protocol, and com.ibm.network.ftp.ui.

Please, if someone had an example (code) of how can I use it. I'll be
very happy.

Thanks.
 
I found this on the javasoft site:

import java.io.*;
import com.oroinc.net.ftp.*;

public class JFTP {

public static void get(String hostname, String filename) {
FTPClient client;

client = new FTPClient();

try {
client.connect(hostname);

if(!FTPReply.isPositiveCompletion(client.getReplyCode())) {
client.disconnect();
System.err.println("FTP server refused connection.");
return;
}

client.login("user", "password");
client.setFileType(com.oroinc.net.ftp.FTP.ASCII_FILE_TYPE);

client.retrieveFile("fileout",
new FileOutputStream(filename));

client.quit();
client.disconnect();
} catch(IOException e) {
e.printStackTrace();
}

}

}

Regards

Ray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top