This means that a client can detect the end of the reply by receiving 0 bytes. It's mostly the receiving code that gets more complex. The easiest enhancement is to make the first character of the message an indicator of message type, and have the type determine the length. You'll need to put that aside and hold onto it, until it's needed. This is also when you'll discover that send does not always manage to get rid of everything in one pass.
Lets move on to cleaning up.