无法连接到ejabberd本地主机 [英] Unable to connect to ejabberd localhost

查看:117
本文介绍了无法连接到ejabberd本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的android应用程序连接到ejabberd本地主机ejabbered服务器未在ejabberd Web管理员上显示在线用户。

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();
      }


推荐答案

您的代码似乎不正确:


  • 用户名应为没有XMPP域的用户名(仅MyId)。

  • ServiceName设置为 jabber.org,这意味着您将尝试连接到该服务器,而不是本地服务器。

这篇关于无法连接到ejabberd本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆