File Transfer failed with error

Using Smack 4.2.0 alpha 1 File transfers between two devices running smack library fails with the IQ being sent below, while transferring a file from device to Spark PC client works both ways.

<iq to='user1' id='G6Ii2-10' type='result'><si xmlns='http://jabber.org/protocol/si'><feature xmlns="http://jabber.org/protocol/feature-neg"><x xmlns='jabber:x:data' type='submit'><field var='stream-method'><value>http://jabber.org/protocol/bytestreams</value><value>http://jabber.org/protocol/ibb</value></field></x></feature></si></iq>
<iq id='G6Ii2-12' type='get' to='user2' from='user1'><query xmlns='http://jabber.org/protocol/disco#info'/></iq>
<iq to='user1' id='G6Ii2-12' type='result'><query xmlns='http://jabber.org/protocol/disco#info'><identity category='client' name='Smack' type='pc'/><feature var='http://jabber.org/protocol/bytestreams'/><feature var='jabber:iq:privacy'/><feature var='urn:xmpp:ping'/><feature var='http://jabber.org/protocol/commands'/><feature var='http://jabber.org/protocol/si/profile/file-transfer'/><feature var='jabber:iq:last'/><feature var='http://jabber.org/protocol/xdata-validate'/><feature var='http://jabber.org/protocol/xhtml-im'/><feature var='vcard-temp'/><feature var='http://jabber.org/protocol/ibb'/><feature var='urn:xmpp:receipts'/><feature var='urn:xmpp:time'/><feature var='http://jabber.org/protocol/xdata-layout'/><feature var='http://jabber.org/protocol/si'/><feature var='http://jabber.org/protocol/muc'/><feature var='http://jabber.org/protocol/disco#items'/><feature var='http://jabber.org/protocol/disco#info'/><feature var='jabber:x:data'/></query></iq>
<iq id='G6Ii2-20' type='set' to='user2' from='user1'><query mode='tcp' xmlns='http://jabber.org/protocol/bytestreams' sid='jsi_8884251155854709297'><streamhost jid='user1' port='7777' host='10.216.186.51'/><streamhost jid='user1' port='7777' host='fe80::c1df:2ebb:1786:b4d8%rmnet0'/></query></iq>
<iq to='user1' id='G6Ii2-20' type='error'><error type='cancel'><item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>Could not establish socket with any provided host</text></error></iq>
7<iq id='G6Ii2-22' type='set' to='user2' from='user1'><open block-size='4096' xmlns='http://jabber.org/protocol/ibb' stanza='iq' sid='jsi_8884251155854709297'/></iq>

After more testing, on WiFi connections files seem to be working ok, but once it hits mobile connections the file transfer gets stuck at negotiating transfer.

From this I see that one of the iq packets has said error and “Could not establish socket with any provided host” which I don’t know why I should be getting this error.

After attempting more transfers from Spark Windows client I received this in the logs when trying to send a file

SEVERE: There was an error during file transfer.

Error in execution:

– caused by: java.util.concurrent.ExecutionException:

– caused by: Could not establish socket with any provided host: item-not-found(404) Could not establish socket with any provided host

at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.negotiateStream(Incom ingFileTransfer.java:199)

at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.access$100(IncomingFi leTransfer.java:47)

at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$1.run(IncomingFileTra nsfer.java:124)

at java.lang.Thread.run(Unknown Source)

Turns out to be a server issue, I was running prosody server and I had to enable file transfer proxy. Moving on with development now.

Nonetheless, file transfer should work, even if the server doesn’t offer any file transfer proxy. The log says it tries to open an IBB stream:

<open block-size=‘4096’ xmlns=‘http://jabber.org/protocol/ibb

but obviously it got never negotiated? Might be this issue: SMACK-584

You are indeed right, as if I remember correctly, previous versions of smack worked without the need of my proxy intervention. It is therefore something to look at for the next smack release hopefully. @wroot