Add typedef and return value for client handler

The return value will tell the client how many
bytes of the message were consumed and whether
the message was partial.
Allocate client read buffer dynamically

Fix out of bounds write of zero terminator if
read fills the entire buffer.