9
我想使用TURNSocket
在兩個用戶之間傳輸文件。如何在ios中的XMPPFramework的TURNSocket中連接成功時接收文件?
用戶1:(iphone sumulator) 用戶2:(星火用戶)
現在套接字連接,我想將文件從用戶2通過星火發送到用戶1。和iPhone sumulator可以收到這些消息:
<iq xmlns="jabber:client" id="P1J6b-29" to="[email protected]/75694fce" from="[email protected]/Spark 2.6.3" type="set">
<si xmlns="http://jabber.org/protocol/si" id="jsi_8334411215933911079" mime-type="image/png"
profile="http://jabber.org/protocol/si/profile/file-transfer">
<file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="a2.png" size="12618">
<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>
我的XMPP Sending/Receving file in iphone sdk ...? 話題有關如何在didSucceed
方法處理中看到了這些,但我不知道如何接收由星火用戶所發送的文件iphone求和器。最後
- (void)writeData:(NSData *)data
withTimeout:(NSTimeInterval)timeout
tag:(long)tag;
,關閉套接字:
然後,在你didSucceed
實現,發送數據中傳遞的插座上,用
- (void)disconnectAfterWriting;
那麼如何編寫接收這個方法或其他文件?
- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket {
// Where is the NSData that can be find to used in writeData method ?
}
嗨,尼爾,你有這個工作嗎? –