0
我打算从我的android应用程序连接到ejabberd本地主机ejabbered服务器不显示ejabberd web管理员上的在线用户。无法连接到ejabberd本地主机
AbstractXMPPConnection conn1;
conn1 = new XMPPTCPConnection("[email protected]", "password", "192.168.1.23");
conn1.connect();
if(conn1.isConnected())
{
Toast.makeText(this,"conn 1 successfull",Toast.LENGTH_LONG).show();
}
// Create a connection to the jabber.org server on a specific port.
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("[email protected]", "password")
.setServiceName("jabber.org")
.setHost("192.1**.1.2*")//My Ip address
.setPort(5222)
.setDebuggerEnabled(true)
.build();
AbstractXMPPConnection conn2 = new XMPPTCPConnection(config);
conn2.connect();
if(conn2.isConnected())
{
Toast.makeText(this,"conn2 successfull",Toast.LENGTH_LONG).show();
}
如果192.168.1.24:5280/admin是域,那么我应该在setHost和setService中写什么? –
以下代码未给出任何例外情况。 –
它取决于您为服务配置的XMPP域。主机可能是您的IP地址。 –