我已将我的asmack库从asmack-issue15.jar
改为asmack-android-7.jar
来自Flowdalic/asmack项目。一切顺利,但我从服务器到Android智能手机的文件传输问题。转移的状态永远不会完成,因为它在状态"正在进行"。
已注册的扩展程序:
providerM.addIQProvider("si", "http://jabber.org/protocol/si", new StreamInitiationProvider());
providerM.addIQProvider("query", "http://jabber.org/protocol/bytestreams", new BytestreamsProvider());
providerM.addIQProvider("open", "http://jabber.org/protocol/ibb", new OpenIQProvider());
providerM.addIQProvider("close", "http://jabber.org/protocol/ibb", new CloseIQProvider());
providerM.addExtensionProvider("data", "http://jabber.org/protocol/ibb", new DataPacketProvider());
接收文件的代码:
File f = new File(PATH_SDCARD + "/tmp/" + request.getFileName());
IncomingFileTransfer transfer = request.accept();
transfer.recieveFile(f);
int cnt = 0;
while(!transfer.isDone() && cnt < 20) {
cnt++;
Log.i(LOG, "STATUS: " + transfer.getStatus().toString());
Log.i(LOG, "SIZE: " + f.length());
Log.i(LOG, "PROGRESS: " + transfer.getProgress());
Thread.sleep(1000);
}
if (transfer.getError() != null) {
Log.i(LOG, "ERROR: " + transfer.getError());
}
if (transfer.getException() != null) {
Log.i(LOG, "EXCEPTION: " + transfer.getException());
}
这里有什么问题?
答案 0 :(得分:0)
这是一个服务器问题。我在openfire中启用了文件传输代理,现在一切正常。