difference between XMPP servername and XMPP servicename?
Asked Answered
M

2

8

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?

Mohave answered 4/3, 2011 at 11:40 Comment(0)
M
8
  • 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).

Meurer answered 4/3, 2011 at 13:11 Comment(1)
so hostname and servername are always the same?Mohave
S
3

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.

Spitz answered 5/3, 2011 at 21:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.