使用iOS XMPPFramework和OpenFire服务器进行TURN连接 [英] TURN Connection using the iOS XMPPFramework and an OpenFire Server

查看:171
本文介绍了使用iOS XMPPFramework和OpenFire服务器进行TURN连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:如何使用iOS XMPPFramework和OpenFire服务器获得成功的TURN连接.我希望能够发送和接收文件.

Problem : How can I get a successful TURN Connection using the iOS XMPPFramework and an OpenFire Server. I want to be able to send and recieve files.

注意:我的代码基于以下教程:

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/

2012年4月13日更新:经过更多研究,我认为我需要在此问题中显示的真正相关的代码是...

Update 13th April 2012 : After more research, I think the real relevant code I need to display in this question is this ...

这是TURNSocket尝试连接的地方

This is where the TURNSocket attempts to connect

XMPPJID *jid = [XMPPJID jidWithString:@"myFriendsUsername@beta.myCompany.co.uk"];

NSLog(@"Attempting TURN connection to %@", jid);

TURNSocket *turnSocket = [[TURNSocket alloc] initWithStream:[self xmppStream] toJID:jid];

[turnSockets addObject:turnSocket];

[turnSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
[turnSocket release];

但是,当我调试代码时,在TURNSocket中,我得到一条注释,指出我们无法从列表中找到单个代理服务器".这是因为数组"streamhosts"从不填充.可能是什么问题?是否有一些XML可以告诉我这个问题?问题可能出在OpenFire上吗?

However, when I debug through the code, in TURNSocket I get to a comment which states that "We were unable to find a single proxy server from our list". This is because the Array 'streamhosts' never gets populated. What could be the issue? Is there some XML somewhere that should tell me the problem? Is the issue likely to be with OpenFire?

推荐答案

如果未向TurnSocket.m提供带有资源的完整jID,则会导致问题!这是在SMChatViewController的viewDidLoad中传递的

The problem is caused if a full jID with a resource is not provided to TurnSocket.m! This is passed in in viewDidLoad of SMChatViewController

例如使用

friendsUsername@beta.myCompany.co.uk/spark

friendsUsername@beta.myCompany.co.uk/spark

而不是

friendsUsername@beta.myCompany.co.uk

friendsUsername@beta.myCompany.co.uk

我在这个项目上的进度可以遵循这里

My progress on this project can be followed here

这篇关于使用iOS XMPPFramework和OpenFire服务器进行TURN连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆