Make the client more robust
Make the client more robust

I added things to detect whether the connection is good, and to
reconnect when it goes bad.

EdLeafe/photoviewer,EdLeafe/photoviewer,EdLeafe/photoviewer