I need to create a network server in C++ for a trading application. This network server needs to perform the following tasks:
handle authentication of clients and provide session id for each session.
handle orders originating from the clients and inform clients about their execution.
handle other data request asked for by the clients and send data back to them.
I am planning to use Boost.Asio networking library and Google protocol buffers to implement the messages being sent from the clients to the server. XML-RPC or SOAP based approaches are a strict no-no as latency is a big concern.
I have the following questions for the stackoverflow community:
Is it a good idea to implement these messages using protocol buffers? I am also considering sending messages Boost serialization library to implement this. When I look at the code, I find myself more confident of implementing this with boost serialization and Google protobuf headers look too heavyweight. Which of these methods will be a) more maintainable and b) require less effort? I guess, both these approaches will work across different platforms.
Is there any other networking library which I should look at apart from Boost.Asio.?I find ACE a little dated as far as C++ coding style is concerned.
Eventually I would like to make this network server run on SSL, however, I do not have any experience with implementing SSL. How much effort would it require to move to SSL later on. Should I start with SSL or can it be added later on?
Does anybody know of a good open source network project, which might have implemented a similar network server using Boost.Asio, to get inspired from?
You should also look at Apache Thrift (originated at Facebook) or Apache Etch (initially developed by Cisco). They are RPC frameworks that make it easy to develop both servers and clients meeting your needs (more or less). For a framework developed using protobuf and boost.asio, look at the server1 project.
BSON ( http://www.mongodb.org/display/DOCS/BSON and http://bsonspec.org ) is a very fast binary protocol. C++ implementation is readily available from mongodb. The fact that it is basically JSON makes it quite easy to implement and maintain.
SSL implementation doesn't add up much extra code to the asio-based server: SSL context initialization with certificate paths and some handshake logic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With