我试图建立到使用咂嘴XMPP服务器的连接。

ConnectionConfiguration cf = new ConnectionConfiguration("jabber.ccc.de");
cf.setTruststorePassword("changeme");
this.connection = new XMPPConnection(cf);
this.connection.connect();
this.connection.login("user", "password");

但每当登录我得到一个XMPPException(从服务器:无反应)和插座被关闭。

任何想法是怎么回事错在这里?

此致

有帮助吗?

解决方案

您是否尝试过看到正在发送的实际XMPP数据/从服务器?

尝试启动这个添加到您的代码:

System.setProperty("smack.debugEnabled", "true");
XMPPConnection.DEBUG_ENABLED = true;

其他提示

尝试这一个。

ConnectionConfiguration cf = new ConnectionConfiguration("jabber.ccc.de",5222, "test");
cf.setTruststorePassword("changeme");
this.connection = new XMPPConnection(cf);
this.connection.connect();
this.connection.login("user", "password");

就把下面这行,你在建立连接之前。

SASLAuthentication.supportSASLMechanism("PLAIN");

这个问题是由一个称为Davanum人解决;看到href="http://davanum.wordpress.com/2007/12/31/android-just-use-smack-api-for-xmpp/" rel="nofollow noreferrer">链接的

的问题是: 你是一个缓慢的互联网连接的后面。 你需要增加超时在咂嘴配置包应答。

奇怪的是,你可以得到这个问题,仅在第一次,客户端系统(Windows)的启动之后。

scroll top