aSmack XMPP 文件传输循环处于“进行中”状态
Posted
技术标签:
【中文标题】aSmack XMPP 文件传输循环处于“进行中”状态【英文标题】:aSmack XMPP filetransfer loops in status "In Progress" 【发布时间】:2012-09-26 15:19:59 【问题描述】:我已将我的 asmack 库从 asmack-issue15.jar
更改为 asmack-android-7.jar
从 Flowdalic/asmack 项目。一切运行顺利,但从服务器到安卓智能手机的文件传输出现问题。传输状态永远不会完成,因为它在“进行中”状态下循环。
注册的扩展:
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());
这里有什么问题?
【问题讨论】:
我只能一次又一次地重复自己。 Without a XMPP stanza trace no one is able to tell you what is going wrong. And if you have your stanzas trace, thanks to the open nature of XMPP, you can find out what is going wrong by yourself. 嘿,这是服务器问题,我在 openfire 中启用了代理文件传输,现在一切正常。谢谢 【参考方案1】:这是服务器问题。我在 openfire 中启用了文件传输代理,现在一切正常。
【讨论】:
以上是关于aSmack XMPP 文件传输循环处于“进行中”状态的主要内容,如果未能解决你的问题,请参考以下文章
android asmack 注册 登陆 聊天 多人聊天室 文件传输XMPP协议简介
无法使用 Beem-Asmack 在 XMPP FileTransfer 中处理上传
Android 文件传输无法通过 XMPP 和 OpenFire 工作