为什么我无法连接到openfire服务器?

编程入门 行业动态 更新时间:2024-10-25 10:28:49
本文介绍了为什么我无法连接到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.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服务器?

本文发布于:2023-10-15 01:14:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1492808.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   服务器   openfire

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!