Using Jingle file transfer to transfer file.

Tai H
Added over 5 years ago

Hi there,

I'm doing a sample which is using Jingle File Transfer:

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)

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


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.

Added by Tai H over 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);