difference between XMPP servername and XMPP servicename?

不羁岁月 提交于 2019-12-04 21:44:43

问题


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?


回答1:


  • 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).




回答2:


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.



来源:https://stackoverflow.com/questions/5193236/difference-between-xmpp-servername-and-xmpp-servicename

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!