Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between XMPP servername and XMPP servicename?

In Smack API, there is a configuration class for connection, described at this page

ConnectionConfiguration

I am confused about the distinction between service name and server name.

Suppose I have a computer named "mybox.mydomain.com", and I have ejabberd on it with a configured host called "myhost" (using the line {hosts, ["myhost"]}. in ejabbed.cfg),

what is the host name, server name and service name in this case?

like image 898
Jus12 Avatar asked Mar 04 '11 11:03

Jus12


2 Answers

  • myhost: service name (or XMPP domain)
  • mybox.mydomain.com: hostname and servername.

You can host an XMPP domain over any host, provided that you set the SRV records right in the DNS or if the client specifies to which host it is supposed to connect (like email).

like image 134
Eric Avatar answered Nov 20 '22 20:11

Eric


Think of the JID you're using to log in, which contains username @ domain. The domain is the logical name of the service you are using. For some services, like jabber.org, the service is run on a box that has the same name as the service. For many others, like WebEx Connect and GoogleTalk, the service domain is a starting point to figure out where to open a socket to, but not the name of the machine. If everything is set up right, you can look up the name of the machine to connect to in the DNS using an SRV record. For example, using dig:

$ dig +short -t SRV _xmpp-server._tcp.gmail.com
20 0 5269 xmpp-server4.l.google.com.
20 0 5269 xmpp-server2.l.google.com.
20 0 5269 xmpp-server1.l.google.com.
5 0 5269 xmpp-server.l.google.com.
20 0 5269 xmpp-server3.l.google.com.

If the service domain is not configured correctly in the DNS, or you're just testing things out, it's often useful to be able to specify this connect host separately from the domain. So for your example, you would use:

ConnectionConfiguration("mybox.mydomain.com",
                        5222,
                        "myhost");

If you ever want this service to be accessed by people off of your network (either client-to-server or server-to-server), it would make sense to rename your service domain to be something fully-qualified, to which you can attach SRV records for those external entities to use.

like image 34
Joe Hildebrand Avatar answered Nov 20 '22 19:11

Joe Hildebrand