试图通过我的Andr​​oid客户端,以达到我的Openfire服务器我的、客户端、服务器、以达到

2023-09-06 22:54:20 作者:我仅有一颗心

我要创造我自己的XMPP Android客户端。所以我begane与三星教程的接口本身与Gmail和,你可以在这里找到: 的http://developer.samsung.com/android/technical-docs/Building-a-Chat-Application

I want to create my own XMPP android client . So I begane with the samsung tutorial which interface itself with gmail and that you can find here : http://developer.samsung.com/android/technical-docs/Building-a-Chat-Application

它的工作就像一个魅力。现在,我trye​​d到安装此客户端与我的Openfire服务器的工作。

It worked like a charm. Now I tryed to setup this client for working with my openfire server.

有关此我转换了如下因素行:

For this I converted the folowing lines:

public static final String HOST = "My public ip(82.65....)";
public static final int PORT = 5222;
public static final String SERVICE = "xmppclient.talkative.com";
public static final String USERNAME = "test";
public static final String PASSWORD = "test";

事实上,我们发现早在连接二传手这些变量:

Actually we find back these variable in the connection setter:

ConnectionConfiguration connConfig = new ConnectionConfiguration(
                    HOST, PORT, SERVICE);
            XMPPConnection connection = new XMPPConnection(connConfig);

最后,我从来没有管理连接到服务器,我总是得到以下错误

Finally I never manage to connect to the server and I always get the following error

03-27 00:18:00.660: E/XMPPChatDemoActivity(29942): Failed to connect to      81.65.**.***:5222.
03-27 00:18:00.663: E/XMPPChatDemoActivity(29942): XMPPError connecting to 81.65.**.***:5222.: remote-server-error(502) XMPPError connecting to 81.65.**.***:5222.

这似乎很简单,但我仍然不能得到正确的连接。

This seems to be very simple but still I cannot get the right connection .

我precise,我有良好的互联网的conf在我的清单。

I precise that I have the good INTERNET conf in my Manifest.

如果任何人有一个线索,这将是非常有用的。

If anyone has a clue it would be really usefull .

感谢

推荐答案

服务 - 为您的Openfire实例的服务器名称,它应该是 talkative.com 。 主机 - 这是服务器的机器,如:对公共DNS名称 xmppclient.talkative.com PORT - 5222在默认设置中,检查该端口应该是打开以公网

SERVICE - is the "Server name" of your openfire instance, it should be talkative.com. HOST - it is a public DNS name of the server machine, e.g. xmppclient.talkative.com PORT - 5222 in the default setup, check this port should be open to public network.

如果你有机会到talkative.com的DNS配置,你可以添加SRV记录 _xmpp-server._tcp.talkative.com 指向 xmppclient.talkative.com:5269 (如果你想添加与其他公共XMPP服务器联合服务器)和 _xmpp-client._tcp.talkative.com 指向 xmppclient.talkative.com:5222 。 这是一个完美的设置,在这种情况下的Smack ConnectionConfiguration仅需要

If you have access to DNS configuration of talkative.com, you can add SRV record _xmpp-server._tcp.talkative.com pointing to xmppclient.talkative.com:5269 (if you want to add your server in federation with other public XMPP servers) and _xmpp-client._tcp.talkative.com pointing to xmppclient.talkative.com:5222. This is a perfect setup, in which case Smack ConnectionConfiguration requires only

ConnectionConfiguration connConfig = new ConnectionConfiguration(
                    "talkative.com");

和其他所有参数将自动通过DNS检测。

And all other parameters it will detect automatically via DNS.