Topic: 关于FTP的处理。请各位高手进来看看。 |
Print this page |
1.关于FTP的处理。请各位高手进来看看。 | Copy to clipboard |
Posted by: dingsc Posted on: 2003-03-30 14:21 可否给个demo。 要求如下: 1.编写java程序,登陆Ftp server,将指定目录下文件,下载到客户端。 2.检查,若已经下载成功,则将ftp server里的原文件删除。 3.要求程序不断的执行两项操作。 先行谢过! dingsc@etang.com |
2.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: jiangns3000 Posted on: 2003-03-30 16:22 以下是FTP的示意性代码,只表示大致意思: import java.io.*; import java.net.*; public class FTPClient { private PrintWriter out; private BufferedReader in; private String line; public FTPClient() { try{ Socket s = new Socket("ftp.myftp.com" ,21); out=new PrintWriter(s.getOutputStream() ); in=new BufferedReader(new InputStreamReader(s.getInputStream() )); while(true) {//循环处理FTP协议内容 out.println("发往FTPServer 的FTP协议的命令行") ; out.flush() ; line=in.readLine() ;//读取FTPServer的响应 此时按FTP协议的要求与语义对line进行解释处理 } } catch(){IOException e}{} } public static void main(String[] args) { FTPClient FTPClient1 = new FTPClient(); } } 主要部分是在while()循环中不断地做:向FTPServer发出满足FTP协议的请求并读取FTPServer的响应。只要按照FTP协议要求去做即可。当然真正的程序还要考虑其它一些方面。 |
3.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: dingsc Posted on: 2003-03-31 21:46 FTP协议: 可否详细一点。谢谢了! |
4.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: jiangns3000 Posted on: 2003-03-31 21:57 dingsc,我们又见面了。要写此FTP程序,必啃FTP协议(除非别人有现成的类或组件可用)。要读协议,权威的RFC必不可少。FTP协议:RFC959。FTP协议的标准化安全机制:RFC2228。TFTP:RFC1350。当然HTTP协议:RFC2068(你也许已很熟悉了。) 但愿对你有帮助。 |
5.Re:关于FTP的处理。请各位高手进来看看。 [Re: jiangns3000] | Copy to clipboard |
Posted by: dingsc Posted on: 2003-03-31 23:45 jiangns3000 wrote: 这个问题确实比较麻烦了,感谢你的提示,我会去看看。 |
6.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: floater Posted on: 2003-04-01 00:09 Or get a 3rd party ftp component so you just skip the dirty details. |
7.Re:关于FTP的处理。请各位高手进来看看。 [Re: floater] | Copy to clipboard |
Posted by: dingsc Posted on: 2003-04-01 17:26 floater wrote: 可有何好的例子,请介绍! |
8.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: Julian13 Posted on: 2003-04-01 19:24 how about this one? http://www.savarese.org/oro/downloads/index.html#NetComponents |
9.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: jiangns3000 Posted on: 2003-04-01 21:05 这一个也不错: http://www.enterprisedt.com/downloads/ftp.html |
10.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: floater Posted on: 2003-04-02 00:38 dingsc wrote: http://www.cjsdn.com/post/view?bid=1&id=19841&sty=1&tpg=1&age=0 or do a search on java ftp on google. I used FTPClient a long time ago, not sure whether it's up to date now. Keep in mind everytime when you use a 3rd party tool, you need to raise your shield to safe guard any change in the future. |
11.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: Julian13 Posted on: 2003-04-02 00:59 and these 2: http://www.glub.com/products/secureftp/ Secure FTP is a free client package that allows for a secure connection to be made to an FTP daemon. In this release, we support connecting via the Secure Sockets Layer, or SSL. Future releases may support other authentication mechanisms (e.g. Kerberos, one-time-passwords). http://www.jscape.com/inetfactory/index.html iNet Factory is a robust suite of Internet networking components for the Java™ platform. The components included in iNet Factory provide all the tools necessary to quickly develop Internet capable Java™ applications with minimum coding effort. Included are components for FINGER, FTP, HTTP, HTTPS, IMAP4, POP3, SMTP, MIME, NNTP, NSLOOKUP, REXEC, RLOGIN, RSH, TELNET, WHOIS and other frequently used protocols. |
12.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: dingsc Posted on: 2003-04-02 09:16 Thanks! |
13.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: dingsc Posted on: 2003-04-03 08:52 检查文件是否下载,有难度。 因为我的SERVER会不断有新的文件产生。 |
14.Re:关于FTP的处理。请各位高手进来看看。 [Re: dingsc] | Copy to clipboard |
Posted by: jiangns3000 Posted on: 2003-04-03 09:23 FTP的二进制文件传输,是否有错,是否已下载,以及其它情况,你使用的FTP网络组件应该有处理。再看其DOC。 |
15.Re:关于FTP的处理。请各位高手进来看看。 [Re: jiangns3000] | Copy to clipboard |
Posted by: dingsc Posted on: 2003-04-03 10:36 我下载了以下组件:www.amoebacode.com\ftp\default.htm 好像比较全。 但好像没有相关解决方案。 另外我找到了一个FTP程序,看来是根据协议编的。得好好琢磨琢磨。 Mr.jiangns3000,还有我上次发的email可否再帮我想想办法。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |