Added communication error handling to the client.