difference between XMPP servername and XMPP servicename?

后端 未结 2 1479
囚心锁ツ
囚心锁ツ 2021-02-15 16:32

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

ConnectionConfiguration

I am confused about the distinction between service n

相关标签:
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.

    0 讨论(0)
  • 2021-02-15 17:06
    • 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).

    0 讨论(0)
提交回复
热议问题