Added a way to gracefully recover from socket errors.
Made the client write its name immediately.