I'm working on a project that involves several applications on several computers. The main application is a C++ socket server running on a CentOS server, and the client application is a Java program running on client PCs.

These will communicate back and forth using sockets. I have defined a set of commands and arguments that they will need to implement in order to support everything.

I've thought of several options, but I can't seem to find the perfect one.. 

* Should the C++ and Java program write their own classes/parsers for validate the messages?
* Should I create an XML file (served over HTTP) that defines all of the communication messages? (That the server/client would parse and create actions for)
* Or use some kind of third party library (Google Protocol Buffers?)

The point is that when the Socket server sends a message `X`, then the client must know what to do with it. Same applies the other direction.

What would be the best way to implement this? Having the XML file would be nice, as the client/server may parse it and create methods/actions based on the data. But a more clearer approach would be to create classes that would do the parsing.