【问题标题】:XMPP client for ejabberd server: Smack ConnectionConfiguration not connecting to localhostejabberd 服务器的 XMPP 客户端:Smack ConnectionConfiguration 未连接到 localhost
【发布时间】:2015-01-26 17:26:24
【问题描述】:

我正在尝试使用 Smack API 从 Java 连接 ejabberd 服务器。当我使用以下代码时,我可以连接到 ejabberd 服务器。

XMPPTCPConnection connection = new XMPPTCPConnection("localhost");
connection.connect();

但是,当我以下列方式使用 ConnectionConfiguration 时,它会显示连接异常或无响应错误。

    ConnectionConfiguration conf = new ConnectionConfiguration("localhost",5280);
    conf.setReconnectionAllowed(false);
    XMPPTCPConnection connection = new XMPPTCPConnection(conf);
    connection.connect();

我无法解决问题。请帮忙 。

【问题讨论】:

标签: xmpp ejabberd smack


【解决方案1】:

我看到您正在使用端口 5280。这是基于 Bosh 的 XMPP 的 HTTP 端口。 但是,您正在尝试通过标准 TCP 套接字使用 XMPP 进行连接。 您确定不应该使用端口 5222 吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-15
    相关资源
    最近更新 更多