title: File transfer using XMPP (Extension XEP-0065)
body: <p>Not sure why I am getting turn socket failed (turnSocketDidFail called). Anybody can help me in figure out this? Please point me what am I doing wrong here. I know there are lots of question like this and I have already checked all of these and from that I have taken little help already. One of client is Spark and other is simulator.</p>
  
  <p><strong>Settings:</strong><br>
  Server: testXyz<br>
  Senderjid: user1@testXyz<br>
  Receiverjid: user2@testXyz<br></p>
  
  <pre><code>XMPPJID *jid = [XMPPJID jidWithString:Receiverjid];
  [TURNSocket setProxyCandidates:[NSArray arrayWithObjects:Receiverjid, nil]];
  TURNSocket *turnSocket = [[TURNSocket alloc] initWithStream:self.chatManager.xmppStream toJID:jid];
  [turnSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
  </code></pre>
  
  <p><strong>Console logs</strong></p>
  
  <pre><code>SEND: 
  &lt;iq type="get" to="Receiverjid" id="C15C428D-6007-4B4E-96D5-65F7A307121A"&gt;&lt;query xmlns="http://jabber.org/protocol/disco#items"/&gt;&lt;/iq&gt;
  
  RECV:
  &lt;iq xmlns="jabber:client" type="result" id="C15C428D-6007-4B4E-96D5-65F7A307121A" from="Receiverjid" to="Senderjid/4840c8ae"&gt;
  &lt;query xmlns="http://jabber.org/protocol/disco#items"&gt;
  &lt;item jid="Receiverjid" node="http://jabber.org/protocol/tune"/&gt;
  &lt;item jid="Receiverjid/Spark 2.6.3"/&gt;
  &lt;/query&gt;
  &lt;/iq&gt;
  
  SEND: 
  &lt;iq type="get" to="Receiverjid" id="A4D8B427-B323-4152-8B19-7B55164E9C4B"&gt;
  &lt;query xmlns="http://jabber.org/protocol/disco#info"/&gt;
  &lt;/iq&gt;
  
  RECV: 
  &lt;iq xmlns="jabber:client" type="result" id="A4D8B427-B323-4152-8B19-7B55164E9C4B" from="Receiverjid" to="Senderjid/4840c8ae"&gt;
  &lt;query xmlns="http://jabber.org/protocol/disco#info"&gt;
  &lt;identity category="account" type="registered"/&gt;
  &lt;identity category="pubsub" type="pep"/&gt;
  &lt;feature var="http://jabber.org/protocol/disco#info"/&gt;
  &lt;/query&gt;
  &lt;/iq&gt;
  
  SEND: 
  &lt;iq type="get" to="Receiverjid/Spark 2.6.3" id="2DE55487-9203-4266-A559-1B1D3DC5FBF4"&gt;
  &lt;query xmlns="http://jabber.org/protocol/disco#info"/&gt;
  &lt;/iq&gt;
  
  RECV:
  &lt;iq xmlns="jabber:client" id="2DE55487-9203-4266-A559-1B1D3DC5FBF4" to="Senderjid/4840c8ae" type="result" from="Receiverjid/Spark 2.6.3"&gt;
  &lt;query xmlns="http://jabber.org/protocol/disco#info"&gt;
  &lt;identity category="client" name="Smack" type="pc"/&gt;
  &lt;feature var="http://www.xmpp.org/extensions/xep-0166.html#ns"/&gt;
  &lt;feature var="urn:xmpp:tmp:jingle"/&gt;
  &lt;/query&gt;
  &lt;/iq&gt;
  
  RECV:
  &lt;iq xmlns="jabber:client" id="2DE55487-9203-4266-A559-1B1D3DC5FBF4" to="Senderjid/4840c8ae" type="result" from="Receiverjid/Spark 2.6.3"&gt;
  &lt;query xmlns="http://jabber.org/protocol/disco#info"&gt;
  &lt;identity category="client" name="Smack" type="pc"/&gt;
  &lt;feature var="http://jabber.org/protocol/xhtml-im"/&gt;
  &lt;feature var="http://jabber.org/protocol/muc"/&gt;
  &lt;feature var="http://jabber.org/protocol/bytestreams"/&gt;
  &lt;feature var="http://jabber.org/protocol/commands"/&gt;\
  &lt;feature var="http://jabber.org/protocol/si/profile/file-transfer"/&gt;
  &lt;feature var="http://jabber.org/protocol/si"/&gt;
  &lt;feature var="http://jabber.org/protocol/ibb"/&gt;
  &lt;/query&gt; 
  &lt;/iq&gt;
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>If I am changing:</p>
  
  <p><code>[TURNSocket setProxyCandidates:[NSArray arrayWithObjects:Receiverjid, nil]];</code> </p>
  
  <p>to:</p>
  
  <p><code>[TURNSocket setProxyCandidates:[NSArray arrayWithObjects:Server, nil]];</code></p>
  
  <p>It gives me:</p>
  
  <p><code>&lt;error code="503" type="cancel"&gt;&lt;service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/&gt;&lt;/error&gt;</code>.</p>
  
  <p>As suggested in one of question on stack to resolve this error I have replaced Receiverjid: 'user2@testXyz' by 'user2@testXyz/spark' but am still getting same error.</p>