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地址。 –