自己的代码如下:
RandomAccessFile raf = new RandomAccessFile(localFile, "r");
OutputStream out;
//读写操作
..................
out.flush();
raf.close();
out.close();
Log.i(TAG, "befor setDefaultTimeout");
CLogger.i(TAG, "befor setDefaultTimeout");
ftpClient.setDefaultTimeout(1000 * 10);
Log.i(TAG, "befor completePendingCommand");
boolean result = ftpClient.completePendingCommand();
Log.i(TAG, "after completePendingCommand");
从log中看出:
befor completePendingCommand 已打印
after completePendingCommand 未打印
可以判断是completePendingCommand方法一直没有返回。
我看了FtpClient 的源码,发现completePendingCommand做的事比较简单:
public boolean completePendingCommand() throws IOException
{
return FTPReply.isPositiveCompletion(getReply());
}
不知道为何会阻塞。
求高人指点,多谢!!