通过Asmack在实时服务器上建立Openfire XMPP Connection Android的问题

时间:2015-08-07 18:34:57

标签: android xmpp openfire asmack

通过Asmack在实时服务器上建立Openfire XMPP Connection Android的问题。 我无法与服务器建立连接。当我将它指向本地主机时,相同的代码工作正常但在指向实时服务器时会出现问题。

建立连接时捕获到异常:连接失败。没有来自服务器的响应

xmppConfig = new ConnectionConfiguration(Constants.XMPP_BASE_URL, Constants.XMPPP_PORT,Constants.XMPP_RESOURCE);
xmppConfig.setSASLAuthenticationEnabled(true);
xmppConfig.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
if (xmppConfig == null)
    throw new NullPointerException("XMPPService must be configured before it can connect!");
try {
    if (xmpp == null) {
        xmpp = new XMPPConnection(xmppConfig);
    }
    xmpp.connect();
    state = State.CONNECTED;
} catch (XMPPException ex) {
    Log.d(XMPPController.class.getName(), ex.toString());
}

1 个答案:

答案 0 :(得分:1)

问题已经解决。 问题实际上存在于服务器端。一些服务器端设置阻止了使用open-fire。这个问题在android方面不存在。