Unable to connect to ejabberd localhost

不羁岁月 提交于 2019-12-25 05:48:07

问题


I am tyring to connect to the ejabberd localhost from my android application The ejabbered server does not show the online user on 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();
      }

回答1:


Your code seems incorrect:

  • Username should be the username without XMPP domain (Just MyId).
  • ServiceName is set to "jabber.org", which mean you will try to connect to that server, not your local server.


来源:https://stackoverflow.com/questions/32666092/unable-to-connect-to-ejabberd-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!