Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Beginner
Apr 5, 1999

Reading Files with FTP

Question:
I want to create an applcation that reads a file from a host on my LAN. The file must be read by FTP. How do I do this?

Answer:
If all you need to do is retrieve a single file by FTP, the easiest way to do this is to use the URL and URLConnection classes, referencing the file FTP-style URL (e.g., ftp://ftp.java-pro.com/). If you need to list directories and check file sizes, however, a dedicated FTP package might be more in line. The code for these alternatives is already listed in other questions, so I won't repeat it here. Take a look at the questions titled "Fetch contents of URL" to see how to use the URL class and "FTP with Java" to see how to use a dedicated FTP package. Both questions are in the Networking section of the Java section of the inquiry.com Web site.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date