Allow partial message reception

Handles cases where a read returns a partial packet by saving partial
pieces until a full packet is read.