感谢http://mobile.tutsplus.com/tutorials/iphone/building-a-jabber-client-for-ios-xmpp-integration/ ,我已经安装了Openfire并创建了一个 iOS 客户端。我可以完美地在 Spark 和 Adium 之间发送文件,并在它们和我的 iOS 客户端(在模拟器上运行)之间发送消息。但是,我无法从我的 iOS 客户端向/从 Spark 和 Adium 发送文件。所有 Spark、Adium 和模拟器都在我的 Mac 上运行。
这里有一些设置:
xmpp.domain:openfire.local
xmpp.proxy.enabled:真
xmpp.proxy.externalip:proxy.openfire.local
xmpp.proxy.port:7777
我还将这一行添加到 /private/etc/hosts 中,否则我无法远程登录 proxy.openfire.local 7777:
192.xxx.xxx.xxx 代理.openfire.local
接收文件时的日志
RCV: <iq xmlns="jabber:client" id="UKp3O-91" to="test1@openfire.local/77cd3862" from="test2@openfire.local/Spark 2.6.3" type="set"><si xmlns="http://jabber.org/protocol/si" id="jsi_4009669764706051217" mime-type="image/png" profile="http://jabber.org/protocol/si/profile/file-transfer"><file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="Screen Shot 3 PM.png" size="136871"><desc>Sending file</desc></file><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>
SEND: <iq type="error" to="test2@openfire.local/Spark 2.6.3" id="UKp3O-91"><si xmlns="http://jabber.org/protocol/si" id="jsi_4009669764706051217" mime-type="image/png" profile="http://jabber.org/protocol/si/profile/file-transfer"><file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="Screen Shot 3 PM.png" size="136871"><desc>Sending file</desc></file><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><error type="cancel" code="501"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
发送文件时的日志
SEND: <iq type="get" to="test2@openfire.local/Spark 2.6.3" id="123"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
RCV: <iq xmlns="jabber:client" id="123" to="test1@openfire.local/e1d61d2" type="result" from="test2@openfire.local/Spark 2.6.3"><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>
SEND: <iq type="set" to="test2@openfire.local/Spark 2.6.3" id="1235"><si xmlns="http://jabber.org/protocol/si" id="jabber200" profile="http://jabber.org/protocol/si/profile/file-transfer"><file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="image.jpg" size="18699"/><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>
RCV: <iq xmlns="jabber:client" id="1235" to="test1@openfire.local/e1d61d2" from="test2@openfire.local/Spark 2.6.3" 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>
SEND: <iq type="get" to="openfire.local" id="3AB85477-DE06-4D17-9B85-977F38B746BA"><query xmlns="http://jabber.org/protocol/disco#items"></query></iq>
RCV: <iq xmlns="jabber:client" type="result" id="3AB85477-DE06-4D17-9B85-977F38B746BA" from="openfire.local" to="test1@openfire.local/e1d61d2"><query xmlns="http://jabber.org/protocol/disco#items"><item jid="rtpbridge.openfire.local" name="Media Proxy Service"/><item jid="proxy.openfire.local" name="Socks 5 Bytestreams Proxy"/><item jid="pubsub.openfire.local" name="Publish-Subscribe service"/><item jid="conference.openfire.local" name="Public Chatrooms"/></query></iq>
SEND: <iq type="get" to="proxy.openfire.local" id="8C8DCC93-A591-4051-BDB1-C76D22E15527"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
RCV: <iq xmlns="jabber:client" type="result" id="8C8DCC93-A591-4051-BDB1-C76D22E15527" from="proxy.openfire.local" to="test1@openfire.local/e1d61d2"><query xmlns="http://jabber.org/protocol/disco#info"><identity category="proxy" name="SOCKS5 Bytestreams Service" type="bytestreams"/><feature var="http://jabber.org/protocol/bytestreams"/><feature var="http://jabber.org/protocol/disco#info"/></query></iq>
SEND: <iq type="get" to="proxy.openfire.local" id="ECE4ADBB-27FB-45BF-8423-75656DED7C05"><query xmlns="http://jabber.org/protocol/bytestreams"/></iq>
RCV: <iq xmlns="jabber:client" type="result" id="ECE4ADBB-27FB-45BF-8423-75656DED7C05" from="proxy.openfire.local" to="test1@openfire.local/e1d61d2"><query xmlns="http://jabber.org/protocol/bytestreams"><streamhost jid="proxy.openfire.local" host="192.xxx.xxx.xxx" port="7777"/></query></iq>
SEND: <iq type="set" to="test2@openfire.local/Spark 2.6.3" id="E5FFB7B6-670E-4308-9203-B73527950D8C"><query xmlns="http://jabber.org/protocol/bytestreams" sid="jabber200" mode="tcp"><streamhost jid="proxy.openfire.local" host="192.xxx.xxx.xxx" port="7777"></streamhost></query></iq>
RCV: <iq xmlns="jabber:client" id="E5FFB7B6-670E-4308-9203-B73527950D8C" to="test1@openfire.local/e1d61d2" type="result" from="test2@openfire.local/Spark 2.6.3"><query xmlns="http://jabber.org/protocol/bytestreams"><streamhost-used jid="proxy.openfire.local"/></query></iq>
最后调用了这个方法:
[TURNSocket doTotalTimeout]
希望有经验的大神指出问题。提前致谢!