jdecuirm
jdecuirm

Reputation: 83

XMPP hostname issue

I am working with Openfire and xmpp in iOS, i can't get the connection done, here is my code:

[self.xmppStream setHostName:@"openfire.example.net"];
[self.xmppStream setHostPort:5222];

I am recieving the message Unable to connect to server. Check xmppStream.HostName.

I checked my openfire configuration and it is:

server name: openfire.example.net

but there is too Host Name: Decuirs-MacBook-Pro.local

what is the correct name for configuration? Also i have 2 pre created users:

jdecuirm@openfire.example.net but i am not reaching openfire, hope you can help.

EDIT:

Hi all, y entered to openfire.xml configuration file and i only have this:

-->
<!-- 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>

Does this part has something to do why i can't connect to xmpp? Hope you can help.

Upvotes: 0

Views: 2644

Answers (2)

Mohammed Raisuddin
Mohammed Raisuddin

Reputation: 992

One may setup a private xmpp server for internal testing on their local network. The xmpp domain of the server may be something like "testing.mycompany.com",but since the server is internal, an IP (192.168.1.22) is used as the hostname to connect.

Proper connection requires a TCP connection to the IP (192.168.1.22),but the xmpp handshake requires the xmpp domain (testing.mycompany.com).

[xmppStream setHostName:@"192.168.1.22"];
[xmppStream setHostPort:5222]; //Default

Upvotes: 1

vitalyster
vitalyster

Reputation: 5266

In a proper configured environment you should only specify JID and password and never touch hostname and port. All required information should be fetched via DNS queries.

But in your setup: openfire.example.net is a server name, but why you write non-existant server name? How client will find server? Yes, you can call setHostName:@"Decuirs-MacBook-Pro.local" and if this name is publicity visible in your local network (and only in local network) - it will connect. Also you can use your local IP, e.g. 192.168.1.2 as host name.

Upvotes: 2

Related Questions