我正在从我的Android应用程序连接到ejabberd localhost这个ejabbered服务器没有在ejabberd web admin上显示在线用户。
AbstractXMPPConnection conn1;
conn1 = new XMPPTCPConnection("MyID@localhost", "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("MyId@localhost", "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();
}
答案 0 :(得分:0)
您的代码似乎不正确: