我用XMPPFrameWork 的TurnSocket 传文件,TurnSocket的用法真的让我很老火。我用的ejabberd做服务器,挂在ejabberd服务器上的iChat 和 iAduim可以互相发送文件的,服务器就在当前机器上的. TurnSocket是要用到代理服务器,我用XEP-0065协议中写的,查了当前服务器上可用的可用代理
NSError *error = nil;
NSString *strXML = @"<iq type=\"get\"\
from=\"[email protected]\"\
to=\"mini.local\"\
id=\"server_items\">\
<query xmlns=\"http://jabber.org/protocol/disco#items\"/>\
</iq>" ;
NSXMLElement *qust = [[NSXMLElement alloc] initWithXMLString: strXML error: &error ];
NSLog(@"err :%@", error);查到mini.local上有三个代理服务器
@"conference.mini.local", @"pubsub.mini.local", @"vjud.mini.local"
我把代理服务器设置了
NSArray * array = [NSArray arrayWithObjects: @"conference.mini.local", @"pubsub.mini.local", @"vjud.mini.local", nil];
[TURNSocket setProxyCandidates: array];
//
XMPPJID *jid = [XMPPJID jidWithString : @"[email protected]/mini" ];//
_objTURNSocket = [[TURNSocket alloc] initWithStream:_xmppStream toJID: jid ];
[_objTURNSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue() ];
.但是回调还是一直返回失败
- (void)turnSocketDidFail:(TURNSocket *)sender
谁知道TurnSocket是怎么用的呢???
NSError *error = nil;
NSString *strXML = @"<iq type=\"get\"\
from=\"[email protected]\"\
to=\"mini.local\"\
id=\"server_items\">\
<query xmlns=\"http://jabber.org/protocol/disco#items\"/>\
</iq>" ;
NSXMLElement *qust = [[NSXMLElement alloc] initWithXMLString: strXML error: &error ];
NSLog(@"err :%@", error);查到mini.local上有三个代理服务器
@"conference.mini.local", @"pubsub.mini.local", @"vjud.mini.local"
我把代理服务器设置了
NSArray * array = [NSArray arrayWithObjects: @"conference.mini.local", @"pubsub.mini.local", @"vjud.mini.local", nil];
[TURNSocket setProxyCandidates: array];
//
XMPPJID *jid = [XMPPJID jidWithString : @"[email protected]/mini" ];//
_objTURNSocket = [[TURNSocket alloc] initWithStream:_xmppStream toJID: jid ];
[_objTURNSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue() ];
.但是回调还是一直返回失败
- (void)turnSocketDidFail:(TURNSocket *)sender
谁知道TurnSocket是怎么用的呢???
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货