How to handle stream errors in my code?

Hi guys,

Is there any example that show how to properly catch steam errors and work with them?

In my case, my jabber server goes offline from time to time. I have a Java client written with Smack, so I want that it reconnects when the server is online.

Any suggestions are welcome.

The error scenario decribed plagues Spark for ages. If you find a way how to handle that, we would really like to learn about it…

Hi Walter, I got a workaround, but I am not sure that this is a proper solution but it is does its job.

I basically do nothing and Smack attempts to reconnect itself. To make my clients more patient I added

connection.addConnectionListener(new ConnectionListener() {…});

To illustrate reconnection process in the terminal. So far everybody is happy. This night our ejabberd server was down again for some while and all services that were connected to it survived and now up and running absolutely automatically.

Hope it will work in the future too :slight_smile: