Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How should the client handle a lost connection to the server

 
Paul Simon Connolly
Greenhorn
Posts: 7
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm just about ready to upload my project and register for the exam, just doing final checks, and I've one remaining question at the moment.
"How should the client handle a loss in connection to the server?"

At the moment, if I kill the server and then try and search, I show an error message to the user stating that the connection has been lost and that the user will need to restart the application.
Would you say that this is good enough? Or should I have some sort of reconnection mechanism?

Kind Regards,
Paul
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I'd say that's pretty much it.

Or should I have some sort of reconnection mechanism?


Well, since it isn't required, I wouldn't go for it.
 
K. Tsang
Bartender
Posts: 3397
13
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Roberto here. No need to implement reconnection for the client.

Well for me, I did a shutdown hook for the server. If the server is going to shut down I prolong for say 2 minutes informing connected clients about the shut down.

Of course this approach will have some sort of ping test once in a while. Again this is not required.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic