Search code examples
javaxmppopenfiresmack

'remote-server-timeout' exception as I try to connect to the server


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)

What could be the reason for this ?

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.


Solution

  • You can use

    Connection connection = new XMPPConnection("192.168.0.101");
    connection.connect();
    

    or if you want to specify the port

    ConnectionConfiguration config = new ConnectionConfiguration("192.168.0.101", 5222);
    Connection connection = new XMPPConnection(config);   
    connection.connect();
    

    or similar, defaulting to port 5222

    ConnectionConfiguration config = new ConnectionConfiguration("192.168.0.101");
    Connection connection = new XMPPConnection(config);
    connection.connect();