我在使用Smack时尝试连接到Openfire(我已安装在我的计算机上)时遇到了一些麻烦.
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()行中出现某种错误.
连接到localhost的XMPPError:5222:remote-server-error(502)连接到localhost的XMPPError:5222. – 由:java.net.SocketException引起:权限被拒绝.
我已经尝试将主机名切换为“localhost”,但它也没有用.
我没有这个XMPP业务的经验,所以我猜这是一个常见的新手问题或类似的东西……
可能是什么问题?我该如何解决这个问题,以便连接成功?