2012-03-01 68 views
1
I am using asmack library for connect local XMPP server. 
    it connects properly with local server but it gives me problem 
    while login .. 

{ 
    SmackConfiguration.setPacketReplyTimeout(packetReplyTimeout); 
    ConnectionConfiguration cc = new ConnectionConfiguration("192.168.1.11",5222,"360degree"); 
    /*cc.setSASLAuthenticationEnabled(false); 
    cc.setSecurityMode(SecurityMode.disabled);*/ 
    connection = new XMPPConnection(cc); 

    try{ 
     connection.connect(); 
     Log.d("TAG1", "m in try1111111"); 
     SASLAuthentication.supportSASLMechanism("PLAN",0); 

     connection.login("[email protected]","kutbi1"); 
     Log.d("TAG1", "m in try12121212121212"); 
     Presence presence = new Presence(Presence.Type.available); 
     presence.setMode(Presence.Mode.available); 
     presence.setStatus("Gone fishing"); 
     Log.d("TAG2", "m in try2222"); 
     connection.sendPacket(presence); 
     } 

    Same code is work for Facebook chat connection with XMPP. 

回答

0

SASL基本上是使用安全身份驗證的標準。客戶端當前在Openfire和Smack之間使用SASL認證,所以它應該適合您。首先要確定的是你的服務器是否支持這個功能,那麼你試圖使用哪種服務器?如果你的服務器不支持SASL,你可以告訴Smack不要通過ConnectionConfiguration類中的setSASLAuthenticationEnabled方法使用它。

相關問題