我试图连接到服务器时出现'remote-server-timeout'异常 [英] 'remote-server-timeout' exception as I try to connect to the server
本文介绍了我试图连接到服务器时出现'remote-server-timeout'异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试通过以下代码连接到 openfire 服务器时:
While trying to connect to openfire server through the following code :
Connection connection = new XMPPConnection("https://192.168.0.101:5222");
connection.connect();
我得到一个例外,其中说:
I get an exception which says :
https://192.168.0.101:5222:5222 Exception: Could not connect
to https://192.168.0.101:5222:5222.; : remote-server-timeout(504)
这可能是什么原因?
注意:我已经允许openfire防火服务器通过防火墙。我也试过推迟防火墙,但结果相同。服务器是我自己的机。我尝试运行该程序的同一台机器。
Note : I have allowed openfire fire server through the firewall.I also tried putting off the firewall, but the same result.Server is my own machine. The same machine on which I am trying to run the program.
推荐答案
您可以使用
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
or similar, defaulting to port 5222
ConnectionConfiguration config = new ConnectionConfiguration("192.168.0.101");
Connection connection = new XMPPConnection(config);
connection.connect();
这篇关于我试图连接到服务器时出现'remote-server-timeout'异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文