2010-02-15 81 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"); 
相關問題