的FTPClient(org.apache.commons.net.ftp.FTPClient)当其他客户端消耗(删除/移动)的文件,而FTP仍在上传挂断。 这里是我如何上传文件的代码:阿帕奇FTPClient上删除FTP文件,而它上传
ftpClient = getFTPConnection();
BufferedInputStream buffIn = new BufferedInputStream(inputStream);
byte[] buffer = new byte[8192];
OutputStream os = ftpClient.storeFileStream(filename);
int readCount = 0;
while ((readCount = buffIn.read(buffer)) > 0) {
os.write(buffer, 0, readCount);
}
os.close();
buffIn.close();
inputStream.close();
ftpClient.completePendingCommand(); //!stuck here!
ftpClient.rename(filename, "uploadRename.txt");
ftpClient.logout();
ftpClient.disconnect();
当文件被删除,而上传时,将os.write完成其工作(这是确定),但调用completePendingCommand()程序时后留卡。 ftpClient.completePendingCommand()必须完成第二个命令,如果我明白这个权利,删除它不是解决方案。 任何人都知道为什么ftpClient挂起? 我只是期望一个错误消息或超时如果completePendingCommand没有得到他想要的ftp。
感谢