File Transfer negotiates stream but progress remains at 1.0

am new to smack and openfire and i was recently trying to send a file from one pc to another but each time progress doesnt proceed beyond 1.0 on the sending side and 0.0 on the receiving side. i was using the example in the file transfer extension documentation:

http://www.igniterealtime.org/builds/smack/docs/latest/documentation/extensions/

// Create the file transfer manager

FileTransferManager manager = new FileTransferManager(connection);

// Create the outgoing file transfer

OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("romeo@montague.net");

// Send the file

transfer.sendFile(new File(“shakespeare_complete_works.txt”), “You won’t believe this!”);

but i cant seem to transfer the file, its a simple text file. please somebody help, i have read through most of the discussions concering file transfer in this community but non of them solves the problem

I can only point to https://github.com/Flowdalic/asmack/wiki/aSmack-XMPP-File-Transfer

It’s for aSmack but applies to Smack too.

ive tried using the asmack library between two android phones and this is the raw xml i see from the smack debugger:

Status: Negotiating Transfer

Progress: 0.0

12:28:18 PM RCV (1126358760):

what could this mean and how can i solve it.

It’s hard to get an idea why the error iq is send without seeing the other stanzas of the file transfer.

ok, so here is the code i use to send

// Create the file transfer manager

FileTransferManager manager = new FileTransferManager(connection);

// Create the outgoing file transfer

OutgoingFileTransfer transfer = manager

                .createOutgoingFileTransfer("person1@server.com");

// Send the file

try {

transfer.sendFile(testFile, “test file”);

while (!transfer.isDone()) {

System.out.println(transfer.getStatus());

System.out.println(transfer.getProgress());

Thread.sleep(1000);

}

} catch (XMPPException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

and here is the code i use to receive:

ProviderManager.getInstance().addIQProvider(“query”,

                    "[http://jabber.org/protocol/bytestreams](http://jabber.org/protocol/bytestreams)",

new BytestreamsProvider());

ProviderManager.getInstance().addIQProvider(“query”,

                    "[http://jabber.org/protocol/disco#items](http://jabber.org/protocol/disco#items)",

new DiscoverItemsProvider());

ProviderManager.getInstance().addIQProvider(“query”,

                    "[http://jabber.org/protocol/disco#info](http://jabber.org/protocol/disco#info)",

new DiscoverInfoProvider());

Log.i(“Recieve File”,

“new file transfere request new file transfere request new file transfere request”);

Log.i(“file request”, “from” + request.getRequestor());

IncomingFileTransfer transfer = request.accept();

Log.i(“Recieve File alert dialog”, “accepted”);

try {

transfer.recieveFile(new File("/sdcard/"

  • request.getFileName()));

while (!transfer.isDone() || (transfer.getProgress() < 1)) {

try {

Thread.sleep(1000);

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Log.i(“Recieve File alert dialog”, "still receiving : "

  • (transfer.getProgress()) + " status "

  • transfer.getStatus());

// Log.i(“Error file”,

// transfer.getError().getMessage());

Log.i(“Recieve File alert dialog”,

"cancelling still receiving : "

  • (transfer.getProgress()) + " status "

  • transfer.getStatus());

transfer.cancel();

break;

}

} catch (XMPPException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

});

and here is what i get in the debugger:

02:39:34 PM SENT (1110315608):

<iq

id=“1G8gb-6”

from="person1@server.com/Smack"

to="person2@server.com/Smack"

type=“set” >

<si

id=“jsi_8806139579303662506”

mime-type=“image/jpeg”

    profile="[http://jabber.org/protocol/si/profile/file-transfer](http://jabber.org/protocol/si/profile/file-transfer)"

    xmlns="[http://jabber.org/protocol/si](http://jabber.org/protocol/si)" >

<file

name=“IMG-20131114-WA0000.jpg”

size=“13033”

        xmlns="[http://jabber.org/protocol/si/profile/file-transfer](http://jabber.org/protocol/si/profile/file-transfer)" >

You won't believe this!

    <feature xmlns="[http://jabber.org/protocol/feature-neg](http://jabber.org/protocol/feature-neg)" >

<x

type=“form”

xmlns=“jabber:x:data” >

<field

type=“list-single”

var=“stream-method” >

http://jabber.org/protocol/bytestreams

http://jabber.org/protocol/ibb

STATUS: initial

PROGRESS: 0.0

<iq

id=“1G8gb-6”

from="person1@server.com/Smack"

to="peron2@server.com/Smack"

type=“error” >

<error

code=“501”

type=“CANCEL” >

IS DONE

i hope this gives you more clarity on the problem iam facing

The displayed stanzas don’t add up. The are both from person1@server.com but carry the same id. If the second stanza is the error reply of the first one, and you only made a mistake disguising the JIDs, then it seems like the enity of the second stanza does not have XEP-95 enabled. Which version of (a)Smack do you use?

well the jar am using is asmack-android-8-0.8.9beta4. could it be that this version doesnt support file transfer

oh and yes i had just made a mistake disguising the JIDs

No, it does support file transfer. Die you init the static code as the README tell you to do? Did you follow the instructions about receiving a file transfer in the documentation? Die you register a FileTransferListener?

I hadnt initiated the static code, but now that i have this what i get:

05:50:32 PM SENT (1108953728): You won’t believe this!http://jabber.org/protocol/bytestreamshttp://jabber.org/protocol/ibb

Negotiating Transfer

05:50:33 PM RCV (1108953728): http://jabber.org/protocol/bytestreamshttp://jabber.org/protocol/ibb

05:50:33 PM SENT (1108953728):

05:50:34 PM RCV (1108953728):

05:50:34 PM SENT (1108953728):

05:50:35 PM RCV (1108953728):

05:50:35 PM SENT (1108953728):

05:50:35 PM RCV (1108953728):

05:50:35 PM RCV (1108953728):

but it never leaves the status of negotiating stream and progress of 0

sorry to be a pest but iam new to all this any help you can give will be very helpful

The stanzas are incomplete. Please try to get a full capture of every stanza involved in the file transfer.

XMPP is an open protocol, with a full stanza log and the knowledge of the specification, you should be able to determine the cause of the failing file transfer. But feel free to post the captured stanzas also here and I’ll have a look.

i realy only know the basics of the specification but iam going to try to explore it much deeper. Here is as much of the raw xml stanzas as i could capture, it reaches a point and just remains on status: negotiating stream and progress 0

07:50:07 PM SENT (1109716248): You won’t believe this!http://jabber.org/protocol/bytestreamshttp://jabber.org/protocol/ibb

07:50:09 PM RCV (1109716248): http://jabber.org/protocol/bytestreamshttp://jabber.org/protocol/ibb

07:50:09 PM SENT (1109716248):

07:50:10 PM RCV (1109716248):

07:50:10 PM SENT (1109716248):

07:50:10 PM RCV (1109716248):

07:50:10 PM SENT (1109716248):

07:50:10 PM RCV (1109716248):

07:50:10 PM SENT (1109716248):

07:50:11 PM RCV (1109716248):

07:50:11 PM SENT (1109716248):

07:50:11 PM RCV (1109716248):

07:50:11 PM SENT (1109716248):

07:50:12 PM RCV (1109716248):

07:50:12 PM SENT (1109716248):

07:50:12 PM RCV (1109716248):

07:50:12 PM SENT (1109716248):

07:50:13 PM RCV (1109716248): <streamhost jid="proxy.server.ma

07:50:13 PM RCV (1109716248): sikini.com" host=“192.163.219.48” port=“7777”/>

07:50:13 PM SENT (1109716248):

07:50:23 PM SENT (1109716248):

thanks alot for your help

There is a lot of noise in the track, also some indentation would make the XMPP stanzas more readable and there are some stanzas missing, especially at the end.

07:50:12 PM SENT (1109716248):

07:50:12 PM RCV (1109716248):

07:50:12 PM SENT (1109716248):

07:50:13 PM RCV (1109716248): <streamhost jid="proxy.server.ma

07:50:13 PM RCV (1109716248): sikini.com" host=“192.163.219.48” port=“7777”/>

07:50:13 PM SENT (1109716248):

07:50:23 PM SENT (1109716248):

Seems like the one enity is unable to use the streamhost and then tries to establish an ibb transfer. At this point, your capture ends. Not sure what’s goign on after that.

Filetransfer status: Negotiating Stream. Progress: 0.0

What is the actual issue i got stuck into this

06-14 11:49:27.948 26378-26483/rxjava.com.websocketsdemo D/SMACK: SENT (0): http://jabber.org/protocol/bytestreams