2010-02-15 79 views
1

我正尝试使用smack建立与XMPP服务器的连接。XMPP服务器不响应Smack登录请求

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

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

任何想法这里有什么问题吗?

问候

+0

我假设jabber.ccc.de使用标准的XMPP端口? – Matt 2010-02-15 14:29:11

+0

我试过ConnectionConfiguration(“jabber.ccc.de”,5222)和ConnectionConfiguration(“jabber.ccc.de”,5223)。两者都有相同的结果。他们在该服务器上使用ejabberd。 Regards – raichoo 2010-02-15 14:39:53

+0

哪个调用导致异常? .connect()或.login()? – sfussenegger 2010-02-15 16:32:18

回答

2

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

尝试启动添加以下内容到代码:

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

谢谢,另一方面的服务器似乎很奇怪。我建议像sfussenegger一样建立自己的Openfire服务器。我认为这个问题现在已经解决了。 此致敬礼 – raichoo 2010-02-16 13:15:41

0

此问题是由一个叫Davanum人处理;请参阅link

问题是: 您的网络连接速度很慢。 您需要在smack config中增加包回复的超时时间。

奇怪的是,在客户端系统(windows)启动之后,您只能第一次得到这个问题。

0

试试这个。

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"); 
0

只要在建立连接之前放置以下行即可。

SASLAuthentication.supportSASLMechanism("PLAIN"); 
相关问题