ftp下载文件,出现Connection reset错误,而ftpbiede

hanutao 2008-10-15 02:40:48
代码如下:

//******************建立连接
FtpClient aftp = new FtpClient(strFTPAddress, Integer.parseInt(strFTPPort));
aftp.login(strFTPUser, strFTPPass);
aftp.binary();

aftp.cd(strFtpSourcesMainDir);
log.info("0\t连接FTP服务器:" + strFTPAddress + " 成功!");
//******************下载文件
String _strSourceFileName = "remotefile";
TelnetInputStream fget=aftp.get(_strSourceFileName);//设置源文件,错误在此发生
java.io.DataInputStream puts = new java.io.DataInputStream(fget);

String strTargetPathFileName = strPhyPath+"/upload/"+_strSourceFileName;
java.io.File fi = new java.io.File(strTargetPathFileName);//设置目的文件
if(fi.exists()){//若文件存在则删除
fi.delete();
}
java.io.RandomAccessFile getFile = new java.io.RandomAccessFile(fi,"rw");
getFile.seek(0);
int ch;
while ((ch = puts.read()) >= 0) {
getFile.write(ch);
}
getFile.close();//关闭文件保存
fget.close();//下载完毕
aftp.closeServer();
...全文
496 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanutao 2008-10-15
  • 打赏
  • 举报
回复
up
hanutao 2008-10-15
  • 打赏
  • 举报
回复
up
hanutao 2008-10-15
  • 打赏
  • 举报
回复
同样的代码,ftp别的服务器下载文件成功,请问高手是何原因

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧