连接Android客户端与本地XMPP服务器后无法登录
问题描述:
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.
答
SASL基本上是使用安全身份验证的标准。客户端当前在Openfire和Smack之间使用SASL认证,所以它应该适合您。首先要确定的是你的服务器是否支持这个功能,那么你试图使用哪种服务器?如果你的服务器不支持SASL,你可以告诉Smack不要通过ConnectionConfiguration类中的setSASLAuthenticationEnabled方法使用它。