I’m currently searching for a Java networking library. What I want to do is sending XML, JSON or other serialized messages from a client to another client and/or client to server.
My first attempt was to create an POJO for each message, plus a MessageWriter for sending and a MessageReader for receiving it. Plus socket and error handling. Which is quite a lot of error prone work.
What I’m looking for is a a higher level library which abstracts from sockets. Furthermore it should supports something like code generation for the messages.
Google’s Protocol Buffers (http://code.google.com/apis/protocolbuffers/) looks promising. But are there alternatives? The emphasis is not on speed or security (at the moment), it is just supposed to work reliable and with a low amount of implementation time.
Ah… gotcha. But rather than using code gen. to marshall and unmarshall, if you have Java on both ends, could you use simple object serialization ? If performance and/or message size is a concern, you could make your Message class externalizable.
I had not looked at Protobuf before. Looks pretty decent. Using that, you would then just need a transmission method.