Read complete messages from socket before processing

Reading a message from the socket might not yield the full message, in which case we need to keep reading until we have it all.