我正在iOS中使用Openfire和xmpp,我无法完成连接,下面是我的代码:
[self.xmppStream setHostName:@"openfire.example.net"];
[self.xmppStream setHostPort:5222];我正在接收无法连接到服务器的消息。检查xmppStream.HostName。
我检查了我的openfire配置,结果是:
服务器名称: openfire.example.net
但是也有主机名: Decuirs-MacBook-Pro.local
配置的正确名称是什么?另外,我有两个预先创建的用户:
jdecuirm@openfire.example.net但是我没有达到开火,希望你能帮上忙。
编辑:
大家好,y输入了openfire.xml配置文件,我只有以下内容:
-->
<!-- root element, all properties must be under this element -->
<jive>
<adminConsole>
<!-- Disable either port by setting the value to -1 -->
<port>9090</port>
<securePort>9091</securePort>
</adminConsole>
<locale>en</locale>
<!-- Network settings. By default, Openfire will bind to all network interfaces.
Alternatively, you can specify a specific network interfaces that the server
will listen on. For example, 127.0.0.1. This setting is generally only useful
on multi-homed servers. -->
<!--
<network>
<interface></interface>
</network>
-->
<connectionProvider>
<className>org.jivesoftware.database.EmbeddedConnectionProvider</className>
</connectionProvider>
<setup>true</setup>
</jive>这个部分有什么关系吗?为什么我不能连接到xmpp?希望你能帮上忙。
发布于 2014-06-18 00:41:15
在适当配置的环境中,您应该只指定JID和密码,并且永远不要、触摸主机名和端口。所有必需的信息都应该通过DNS查询来获取。
但是在您的设置中:openfire.example.net是一个服务器名,但是为什么要编写不存在的服务器名呢?客户端将如何找到服务器?是的,您可以调用setHostName:@"Decuirs-MacBook-Pro.local",如果这个名称在您的本地网络中是可见的(并且只在本地网络中),它将连接。您也可以使用本地IP,例如192.168.1.2作为主机名。
发布于 2016-05-09 10:09:32
您可以设置一个专用的xmpp服务器,以便在本地网络上进行内部测试。服务器的xmpp域可能类似于"testing.mycompany.com",但是由于服务器是内部的,所以使用IP (192.168.1.22)作为连接的主机名。
正确的连接需要一个到IP的TCP连接(192.168.1.22),但是xmpp握手需要xmpp域(testing.mycompany.com)。
[xmppStream setHostName:@"192.168.1.22"];
[xmppStream setHostPort:5222]; //Defaulthttps://stackoverflow.com/questions/24226154
复制相似问题