Slightly more robust IO error handling on client and server