Q: FileTransfer: changes from 3.1 to 3.2?

Hello everyone!

I’m running in troubles while handling with file transfers after I upgraded from Smack 3.1 to 3.2.

In 3.1 I successfully could ran incoming and outgoing file transfers with two Accounts from jabber.org. One Account was bound to Pidgin and another account to my local running self made application. I could transfer files fromt my app to pidgin and vice versa.

I had to upgrade to 3.2 because I had problems in connecting and logging in to some XMPP-Servers which I have to support in my application.

Now im running into the problem that outgoing file transfers (from my app to pidgin) can be established and successfully transfered, but when I try to send a file from pidgin to my application the transfers stops with an error during negotiating the stream.

Exectly spoken I get an exception:

– caused by: java.util.concurrent.ExecutionException: Could not establish socket with any provided host: item-not-found(404) Could not establish socket with any provided host

It is quite strange, that the getState on the transfer object tells returns ERROR but when i call the getError() method i fall into an nullpointer exception when i try to get the message from. The Exception is printed out with help of the getException() method of the tranfser object.

The following packets generated during the file transfer

<iq id="purplebf500384" to="senton82@jabber.org/3fdb5729d1" from="senton@jabber.org/30aaede48499eda0" type="get">
  <query xmlns="http://jabber.org/protocol/disco#info"/>
</iq> <iq id="purplebf500384" to="senton@jabber.org/30aaede48499eda0" type="result">
  <query xmlns="http://jabber.org/protocol/disco#info">
    <identity category="client" name="Smack" type="pc"/>
    <feature var="http://jabber.org/protocol/xhtml-im"/>
    <feature var="http://jabber.org/protocol/muc"/>
    <feature var="http://jabber.org/protocol/bytestreams"/>
    <feature var="http://jabber.org/protocol/commands"/>
    <feature var="http://jabber.org/protocol/si/profile/file-transfer"/>
    <feature var="http://jabber.org/protocol/si"/>
    <feature var="http://jabber.org/protocol/ibb"/>
  </query>
</iq> <iq id="purplebf500385" to="senton82@jabber.org/3fdb5729d1" from="senton@jabber.org/30aaede48499eda0" type="set">
  <si xmlns="http://jabber.org/protocol/si" id="purplebf500386" profile="http://jabber.org/protocol/si/profile/file-transfer">
    <file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="SNV13036.JPG" size="2443157" date="2011-06-12T12:27:26.078Z"/>
    <feature xmlns="http://jabber.org/protocol/feature-neg">
      <x xmlns="jabber:x:data" type="form">
        <field var="stream-method" type="list-single">
          <option>
            <value>http://jabber.org/protocol/bytestreams</value>
          </option>
          <option>
            <value>http://jabber.org/protocol/ibb</value>
          </option>
        </field>
      </x>
    </feature>
  </si>
</iq> <iq id="purplebf500385" to="senton@jabber.org/30aaede48499eda0" from="senton82@jabber.org/3fdb5729d1" 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>
        </field>
      </x>
    </feature>
  </si>
</iq> <iq id="purplebf500387" to="senton82@jabber.org/3fdb5729d1" from="senton@jabber.org/30aaede48499eda0" type="set">
  <query xmlns="http://jabber.org/protocol/bytestreams" sid="purplebf500386" mode="tcp">
    <streamhost jid="senton@jabber.org/30aaede48499eda0" host="10.0.0.99" port="50151"/>
    <streamhost jid="senton@jabber.org/30aaede48499eda0" host="192.168.56.1" port="50151"/>
    <streamhost jid="proxy.eu.jabber.org" host="91.121.109.155" port="7777"/>
  </query>
</iq> <iq id="purplebf500387" to="senton@jabber.org/30aaede48499eda0" from="senton82@jabber.org/3fdb5729d1" type="error">
  <query xmlns="http://jabber.org/protocol/bytestreams" sid="purplebf500386" mode="tcp">
    <streamhost jid="senton@jabber.org/30aaede48499eda0" host="10.0.0.99" port="50151"/>
    <streamhost jid="senton@jabber.org/30aaede48499eda0" host="192.168.56.1" port="50151"/>
    <streamhost jid="proxy.eu.jabber.org" host="91.121.109.155" port="7777"/>
  </query>
  <error code="404" 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> <iq id="purplebf500388" to="senton82@jabber.org/3fdb5729d1" from="senton@jabber.org/30aaede48499eda0" type="set">
  <open xmlns="http://jabber.org/protocol/ibb" block-size="4096" sid="purplebf500386" stanza="iq"/>
</iq> <iq id="purplebf500388" to="senton@jabber.org/30aaede48499eda0" from="senton82@jabber.org/3fdb5729d1" type="error">
  <open xmlns="http://jabber.org/protocol/ibb" block-size="4096" sid="purplebf500386" stanza="iq"/>
  <error code="406" type="MODIFY">
    <not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
  </error>
</iq> <iq id="purplebf500389" to="senton@jabber.org/30aaede48499eda0" from="senton82@jabber.org/3fdb5729d1" type="error">
  <close xmlns="http://jabber.org/protocol/ibb" sid="purplebf500386"/>
  <error code="404" type="CANCEL">
    <item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
  </error>
</iq> <iq id="purplebf500389" to="senton82@jabber.org/3fdb5729d1" from="senton@jabber.org/30aaede48499eda0" type="set">
  <close xmlns="http://jabber.org/protocol/ibb" sid="purplebf500386"/>
</iq> <iq id="purplebf500389" to="senton82@jabber.org/3fdb5729d1" from="senton@jabber.org/30aaede48499eda0" type="error">
  <error code="440" type="CANCEL">
    <item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
  </error>
</iq>

Has anybody any hints why the transfer is failing?

thx in advance

Jep, if you are using the final 3.2 release you may be a victim of the bug that was plagueing Spark too. This was resolved in the 3.2.1 trunk as SMACK-338. The IBB mechanism for file transfers is defect in 3.2.

Thank you very much!

Hi!

I am trying to send files to pidgin or to psi. They can receive the invitation to accept the file. I do accept it but then the file transfer never starts. Did you have this problem? And if so, how did you solved it???

Thanks!!!

Hi!

My file transfers also send or received invitations successfully, but when the transfers tried to negotiate the transfertype I always got an ERROR-State from the FileTransfer-Object. So if you get an error-state too, the problem may be the same as mine and an update of the Smack-API to 3.2.1 via a svn could resolve your problems.

hth,

Thanks for your answer!!!

I have tried to do what you have told me. But I don’t know where I can find smack 3.2.1. I have installed the latest version of 3.2.0.

When I have changed from 3.1.0 to 3.2.0 I have started receiving this message when I disconnect:

couldn’t setup local SOCKS5 proxy on port 7777: Address already in use.

Something else to solve…

I am using Eclipse, so, could you help me finding smack 3.2.1??

Thanks!!

There are no nightly builds of the 3.2.1 branch, so you will have to build it yourself right now from source. The fix will be in the next release, which will be in a few weeks time.

It will also be in the nightly builds for trunk once I do a merge, probably in the next few days.

As for your port in use, you can set the port in the smack-config.xml file.

Hi!!

I have modified FileTransferNegotiator as suggested above (only a condition in an if clause), compiled and added it to my project, but the answer is the same I got before:

“The peer did not find any of the provided stream mechanisms acceptable.”

I’ll wait for further news from you. I don’t know what I am doing wrong.

Thanks.

Edit:

I took a version that was not the adequate. Now I can see that the problem is when it negotiates the stream, or at least that is what I think. The final answer when I print the exception given by the OutgoingFileTransfer object is: “feature-not-implemented(501)”.

I’ll keep trying.

Hi again!!!

I have tried today with the nightly build and I’m still having the same problem: notification received in the IM Client (PSI), transfer accepted and then it doesn’t start. I have used the debugger and these are the last messages before the error is received. DiscoverItems sends this:

And the response containing the error is:

Any idea?? Thanks in advance!!

Hi again!!

Just wondering… DiscoverItems IQ message I have posted above shouldn’t be sent to talk.google.com instead of google.com?? That’s maybe why the answer is 501, service not implemented. Where is the field to set??

Thanks!!

Well it seems that now it works. What I have done is modify ServiceDiscoveryManager (apart from using smack 3.2.1). There are two methods called discoverItems. In those methods I ckeck out that the IQ is never directed to gmail.com, so when the IQ receiver is gmail.com, I change it for jabber.org:

if(entityID.equalsIgnoreCase(“gmail.com”))

disco.setTo(“jabber.org”);

Now it is working fine for gmail accounts. I have to check if all the rest functionalities remain the same.

I also had port 7777 used by openfire due to a previous installation I made a month ago or so. It seems that even if you are not actively running openfire it is somehow running on its own in port 7777.

I hope that this can help someone or if I have done somenthing wrong, let me know. Thanks!!