-1

I am creating a Java a simple client/server program although both are just working fine. The problem is that when the client or the server encountered an error it will stop. Is there a way for my client/server app to continuously run even if it encounters an error?

dimas
  • 2,487
  • 6
  • 40
  • 66

1 Answers1

0

You should run your code in a loop and catch any exceptions inside your loop. e.g.

while (true) {
    try {
    //Do what ever your server does
    } catch (Exception e) {
    //Log your exception to a log file
    }
}
bhspencer
  • 13,086
  • 5
  • 35
  • 44