Problem : I am attempting a TURNSocket (XEP-0065 - SOCKS5) using the iOS XMPPFramework and an OpenFire Server. I want to be able to send and receive files. However, in most scenarios, the receiver returns no response. I currently suspect the problem is to do with the OpenFire proxy server, which times out! This is set up on the local network, and I have edited the hosts file to point to it.
Note : The base of my code is from the following tutorial : http://mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-server-setup/
XML and Error : The sender sends the following XML (after a few other XEP-0065 XML posts back and forth)...
<iq type="set"
to="friendsUsername@beta.myCompany.co.uk/spark"
id="DD96A581-BFA3-47BC-A3C0-D26AD48D7442">
<query xmlns="http://jabber.org/protocol/bytestreams"
sid="DD96A581-BFA3-47BC-A3C0-D26AD48D7442"
mode="tcp">
<streamhost xmlns="http://jabber.org/protocol/bytestreams"
jid="proxy.beta.myCompany.co.uk"
host="127.0.1.1"
port="7777"/>
</query>
</iq>
If I chat to another instance of my app, I get the following error in the recipient when trying to use proxy.beta.myCompany.co.uk
Error Domain=GCDAsyncSocketErrorDomain Code=3 "Attempt to connect to host timed out"
So my main question is, why did it timeout?
Extra Info : If I have a chat between one instance of my app and an Adium IM Chat client, I get no response. However, if I chat to a Spark IM Chat Client, I get the following response ...
<iq xmlns="jabber:client"
id="9A34F268-9FC9-44F8-9662-4651A9E0B633"
to="myUsername@beta.myCompany.co.uk/d04f6694"
from="friendsUsername@beta.myCompany.co.uk/Spark 2.6.3"
type="error">
<query xmlns="http://jabber.org/protocol/bytestreams"
sid="9A34F268-9FC9-44F8-9662-4651A9E0B633"
mode="tcp">
<streamhost jid="proxy.beta.myCompany.co.uk"
host="127.0.1.1"
port="7777"/>
</query>
<error code="406"
type="MODIFY">
<not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
On OpenFire, I needed to set the ip of the proxy using a system property of 'xmpp.proxy.externalip'.
来源:https://stackoverflow.com/questions/10297009/socks5-connection-times-out-gcdasyncsocket-openfire-xep-0065-and-ios-xmppfr