Implementing handling of messages

I'm done with message reading on the server side. I now need to implement a better "protocol" for communications, check the content of message received and send the correct answer.