尝试通过以下代码连接到openfire服务器时:
Connection connection = new XMPPConnection("https://192.168.0.101:5222");
connection.connect();
我得到一个异常,它说:
https://192.168.0.101:5222:5222 Exception: Could not connect
to https://192.168.0.101:5222:5222.; : remote-server-timeout(504)
这可能是什么原因?
注意:我已经允许openfire消防服务器通过防火墙。我也尝试过关闭防火墙,但是结果相同。服务器是我自己的机器。我尝试在其上运行程序的同一台计算机。
您可以使用
Connection connection = new XMPPConnection("192.168.0.101");
connection.connect();
或者如果您想指定端口
ConnectionConfiguration config = new ConnectionConfiguration("192.168.0.101", 5222);
Connection connection = new XMPPConnection(config);
connection.connect();
或类似,默认为端口5222
ConnectionConfiguration config = new ConnectionConfiguration("192.168.0.101");
Connection connection = new XMPPConnection(config);
connection.connect();
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句