当Endisoft爱上了JAVA
I believe I can fly,I can touch the sky
posts - 4,  comments - 1,  trackbacks - 0
二种方法
No1:
URL url = new  URL( " ftp://javaa:javaa@172.168.2.222:21/test/javaa.txt " );
PrintWriter pw 
= new  PrintWriter(url.openConnection().getOutputStream());
pw.write( 
" this is a test " );
pw.flush();
pw.close(); 
No2:
FtpClient ftpClient = new  FtpClient();
ftpClient.openServer( 
" 172.168.2.222 " , 21 ); // IP地址和端口 
ftpClient.login( " javaa " , " javaa " ); // 用户名和密码,匿名登陆的话用户名为anonymous,密码为非空字符串 
ftpClient.cd( " test " ); // 切换到test目录 
PrintWriter pw = new  PrintWriter(ftpClient.put( " javaa.txt " )); // 写入的文件名 
pw.write( " this is a test " );
pw.flush();
pw.close(); 
posted on 2006-09-27 00:48 Endisoft 阅读(364) 评论(0)  编辑  收藏 所属分类: J2SEStruts

只有注册用户登录后才能发表评论。


网站导航:
 

<2024年5月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用链接

留言簿(1)

随笔档案(4)

文章分类(5)

文章档案(3)

类的初始化

最新随笔

搜索

  •  

积分与排名

  • 积分 - 5102
  • 排名 - 3045

最新评论

阅读排行榜

评论排行榜