سؤال

I try to send a File via xmpp and smack

FileTransferManager manager = new FileTransferManager(
            this.xmppConnection);
    OutgoingFileTransfer transfer = manager
            .createOutgoingFileTransfer(this.jid);

transfer.sendFile(file, "test");

while (!transfer.isDone()) {

LOGGER.info("Uploading File: " + file.getName() + "   STATUS: "
    + transfer.getStatus() + "  >> progress: " + 100
    * transfer.getProgress());
try {
        Thread.sleep(100);
    } catch (InterruptedException ex) {
        LOGGER.error("Exception: " + ex);
    }
}

LOGGER.info("File transfer is done: " + file.getName() + "   STATUS: "
    + transfer.getStatus() + "  >> progress: " + 100
    * transfer.getProgress());
LOGGER.info("Amount written: " + transfer.getAmountWritten());
LOGGER.info("Bytes sent: " + transfer.getBytesSent());
LOGGER.info("Peer: " + transfer.getPeer());
LOGGER.info("Error: " + transfer.getError());
LOGGER.info("Exception: ", transfer.getException());

The logs are: Uploading File: image_P9.png STATUS: Initial >> progress: 0.0 Uploading File: image_P9.png STATUS: Negotiating Transfer >> progress: 0.0 File transfer is done: image_P9.png STATUS: Refused >> progress: 0.0 Amount written: -1 Bytes sent: -1 Peer: felix.infraview@jabber.de/IM+ Android Error: null Exception:

so I don't get a Error or Exception. The sending is just refused.

My goal is to send an inline-image to any android client.

هل كانت مفيدة؟

المحلول

STATUS: Refused

...

Peer: felix.infraview@jabber.de/IM+

It means the target peer does not support file transfer methods you offer to. XMPP SI File Transfer is a very complex specification which is not implemented by simple clients. In fact, it does not properly implemented in Smack too, they can give you detailed description about error, but implemented only generic "refused".

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top