Project

General

Profile

Using Jingle file transfer to transfer file.

Tai H
Added about 5 years ago

Hi there,

I'm doing a sample which is using Jingle File Transfer: http://xmpp.org/extensions/xep-0234.html#protocol

According to the steps in the XEP

After the Initiator and Responder have the handshake, they can move to the step file transfer.

In the step [file transfer], I'm not sure that which way we should implement to transfer the files?!

Is there any samples about this?

Many thanks,


Replies (2)

(1)

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 5 years ago

Hi,

I see that Jaxmpp documentation for file transfer is rather outdated.

Jingle filetransfer using S5B is already implemented in Jaxmpp library for J2SE. All you need to do is to call a method initFileTransferManager(true) on Jaxmpp instance before calling login() method. This will enable file transfer implementation with support for Jingle FT over S5B. Next thing to do is to retrieve FileTransferManager instance from Jaxmpp instance by calling getFileTransferManager() which contains methods to send/receive files.

(1)

Added by Tai H about 5 years ago

Many thanks Andrzej. I can run the sample well now. But I also maintain the method like below:

private void startReceiving(final FileTransfer fileTransfer, final Socket socket) {

...

FileOutputStream fos = new FileOutputStream(f);

BufferedOutputStream os = new BufferedOutputStream(fos);

transferData(fileTransfer, socket.getInputStream(), os);

os.close();

...

}

Thanks,

    (1-2/2)