Make socket code more robust

Support high load networks where potentially the message prefix will not
arrive intact the first recv()

Fixes #19