Android-使用Ejabberd和Smack时发生文件传输错误

时间:2019-05-04 22:56:33

标签: android ejabberd smack

我正在使用Smack 4.3.2(Android客户端)和Ejabberd Server。 当我发送文字时,效果很好。但是我对文件传输有问题。 当我尝试发送文件时,出现此错误。

我可以获取fileNamefileSize之类的文件信息,但无法获取文件。从=User1发送到=User2时,出现附件错误。

但是,当我从=User1发送到=User1时,它成功了。

我该如何解决?

有人有这样的错误吗?带有ejabberd_18 + smack4.3.2 + android的fileTransfer有什么例子?

fileTransferManager.addFileTransferListener(
    new FileTransferListener() {
        @Override
        public void fileTransferRequest(final FileTransferRequest request) {
            IncomingFileTransfer transfer = request.accept();
            final File file = new File( “/storage/sdcard/Download/” + transfer.getFileName());
            try {
                transfer.receiveFile(file);
            } catch(Exception e){
                e.printStackTrace();
            }
        }
});

这是错误:

myapplication1 W/System.err: org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: item-not-found - cancel [Could not establish socket with any provided host]
05-04 21:54:21.190 9864-9924/com.example.myapplication1 W/System.err: at org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamRequest.cancelRequest(Socks5BytestreamRequest.java:289)
05-04 21:54:21.190 9864-9924/com.example.myapplication1 W/System.err: at org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamRequest.accept(Socks5BytestreamRequest.java:255)
05-04 21:54:21.190 9864-9924/com.example.myapplication1 W/System.err: at org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.negotiateIncomingStream(Socks5TransferNegotiator.java:102)
05-04 21:54:21.190 9864-9924/com.example.myapplication1 W/System.err: at org.jivesoftware.smackx.filetransfer.FaultTolerantNegotiator.createIncomingStream(FaultTolerantNegotiator.java:72)
05-04 21:54:21.190 9864-9924/com.example.myapplication1 W/System.err: at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$2.call(IncomingFileTransfer.java:191)
05-04 21:54:21.190 9864-9924/com.example.myapplication1 W/System.err: at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$2.call(IncomingFileTransfer.java:186)
05-04 21:54:21.190 9864-9924/com.example.myapplication1 W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-04 21:54:21.191 9864-9924/com.example.myapplication1 W/System.err: at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.negotiateStream(IncomingFileTransfer.java:194)
05-04 21:54:21.192 9864-9924/com.example.myapplication1 W/System.err: at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.access$100(IncomingFileTransfer.java:58)
05-04 21:54:21.192 9864-9924/com.example.myapplication1 W/System.err: at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$1.run(IncomingFileTransfer.java:132)
05-04 21:54:21.192 9864-9924/com.example.myapplication1 W/System.err: at java.lang.Thread.run(Thread.java:818)

0 个答案:

没有答案