无法连接到 ejabberd 本地主机
Unable to connect to ejabberd localhost
我正在尝试从我的 android 应用程序连接到 ejabberd 本地主机 ejabbered 服务器未在 ejabberd 网络管理员上显示在线用户。
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();
}
您的代码似乎不正确:
- 用户名应该是没有 XMPP 域的用户名(只是 MyId)。
- ServiceName 设置为 "jabber.org",这意味着您将尝试连接到该服务器,而不是您的本地服务器。
我正在尝试从我的 android 应用程序连接到 ejabberd 本地主机 ejabbered 服务器未在 ejabberd 网络管理员上显示在线用户。
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();
}
您的代码似乎不正确:
- 用户名应该是没有 XMPP 域的用户名(只是 MyId)。
- ServiceName 设置为 "jabber.org",这意味着您将尝试连接到该服务器,而不是您的本地服务器。