发送文件,asmack(或任何替代品) [英] Sending files with asmack (or any alternatives)

查看:267
本文介绍了发送文件,asmack(或任何替代品)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图发送一个文件, asmack 通过以下内容:

I'm trying to send a file with asmack with the following:

// mConn is an XMPPConnection
FileTransferManager  manager = new FileTransferManager(mConn);
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("operator@domain.corp");
transfer.sendFile(new File(fname), "File for the operator");

我收到也不例外,但在咂嘴日志,我可以看到

I'm receiving no exception but in the smack log I can see

<error type="cancel" code="501"><feature-not-implemented...

有谁知道什么可能是问题的根源在哪里?

Does anyone know what can be the root of the problem?

由于 asmack 一段时间一直没有更新,也许有什么替代呢?

Since asmack hasn't been updated for a while maybe there are any alternatives to it?

推荐答案

我终于想通了。而不是

OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("operator@domain.corp");

现在我使用

String to = mConn.getRoster().getPresence("operator@domain.corp").getFrom();
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(to);

和它的作品的方式。

这篇关于发送文件,asmack(或任何替代品)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆