我在Windows 10中安装了ejabberd,我希望我的Android应用程序(在同一网络中的Android设备上运行)登录到本地托管的ejabberd服务器。
注意:我可以在5280端口访问ejabberd管理员门户网站。来自Android设备的[192.168.x.x:5280 / admin]但无法连接到端口5222.
XMPPTCPConnection的代码:
XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder();
builder.setXmppDomain("192.168.x.x");
builder.setDebuggerEnabled(true);
builder.setUsernameAndPassword("username", "password");
builder.setResource("smack");
XMPPTCPConnection mConnection = new XMPPTCPConnection(builder.build());
我收到以下错误:
I/DNSUtil: Could not resolve DNS SRV resource records for _xmpp-client._tcp.192.168.x.x. Consider adding those. W/System.err: org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: '_xmpp-client._tcp.192.168.x.x:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for _xmpp-client._tcp.192.168.x.x. IN SRV yielded an error response NX_DOMAIN, '192.168.x.x:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for 192.168.x.x. IN A yielded an error response NX_DOMAIN, '192.168.x.x:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for 192.168.x.x. IN AAAA yielded an error response NX_DOMAIN
我还修改了 ejabberd.yml 文件,以便按ejabberd documentation
中所述收听所有ipv4端口listen:
-
port: 5222
ip: "0.0.0.0"
module: ejabberd_c2s
starttls: true
certfile: 'CERTFILE'
protocol_options: 'TLSOPTS'
max_stanza_size: 65536
shaper: c2s_shaper
access: c2s
-
port: 5269
ip: "0.0.0.0"
module: ejabberd_s2s_in
max_stanza_size: 131072
shaper: s2s_shaper
-
port: 5280
ip: "0.0.0.0"
module: ejabberd_http
request_handlers:
"/websocket": ejabberd_http_ws
"/api": mod_http_api
web_admin: true
http_bind: true
## register: true
captcha: false
非常感谢任何工作。