Added logic for failure to connect

Included, in comments at the bottom, suggestions on how to handle the server shutting down.
Merge pull request #1 from jmsv6d/patch-1

Added logic for failure to connect