Try to make client/server communication a bit more robust

Use EOF rather than waiting for closed connection