为什么我无法连接到openfire服务器? [英] Why can't I connect to the openfire server?

查看:555
本文介绍了为什么我无法连接到openfire服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Smack时尝试连接到Openfire(我已安装在计算机上)时遇到了一些麻烦。

I'm having a little bit of trouble trying to connect to Openfire (which I've installed on my computer) while using Smack.

    ConnectionConfiguration config = new ConnectionConfiguration("shin-pc" ,5222);
    config.setCompressionEnabled(true);
    config.setSASLAuthenticationEnabled(true); 
    XMPPConnection connection = new XMPPConnection(config);             
    connection.connect();
    connection.login("test", "test");

当我尝试调试或运行时,中出现某种错误connect() line。

When I try debugging or running, there's an error of some sort in the connect() line.

连接到localhost的XMPPError:5222:remote-server-error(502)连接到localhost的XMPPError :5222。 - 由:java.net.SocketException:权限被拒绝。

我尝试将主机名切换为localhost,它没有'或者工作。

I've tried switching the host name to "localhost", and it didn't work either.

我没有这个XMPP业务的经验所以我想这是一个常见的新手问题或类似的东西......

I have no experience in this XMPP business so I guess it's a common newbie problem or something of the sort...

可能是什么问题?我如何解决这个问题,以便连接成功?

What might be the problem? How can I fix this so the connection will be successful?

推荐答案

我刚刚创建了一个我需要XMPP的新项目,遇到了同样的问题。但是,我意识到这只是因为我忘了在我的清单中添加互联网权限:

I just created a new project in which I need XMPP, and ran into the same problem. However, I realized that it was simply because I had forgotten to add the internet permission in my manifest:

<uses-permission android:name="android.permission.INTERNET"/>

确保你没有犯同样的错误。

Make sure that you haven't done the same mistake.

这篇关于为什么我无法连接到openfire服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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