cxMessage2 library

The cxMessage2 library allows for sending variable size messages over TCP/IP. It is rather low level. The messages are opaque sequences of octets as far as the cxMessage2 layer is concerned.

On the wire each message begins with a little endian 4 byte header which records the size of the message body in bytes:

The following diagram shows the main classes and interfaces involved when using cxMessage2. The yellow boxes are pure abstract interfaces, the blue boxes are classes implemented by the cxMessage2 library, and the green boxes represent classes that might be written by an application using the library.

cxMessage2 has been implemented using boost asio.

Typically an application using the cxMessage2 library will create a single IoContextPool when it starts and close it when it ends.

The IoContextPool is passed into the functions to create a TcpMsgClient or TcpMsgServer.

In order to be able to create either a TcpMsgClient or TcpMsgServer you will need to write a class that implements the pure abstract interface ITcpMsgEndPoint.

This will allow you to handle errors produced by the client or server, and also to create an object that implements the pure abstract interface ITcpMsgSessionHandler for each socket connection that is established, and which the cxMessage2 library uses to create an associated TcpMsgSession.

Your class that implements the pure abstract interface ITcpMsgSessionHandler provides the functions to read and write messages and to handle errors with the socket connection.

There is no concept of message ids and multiplexing in this layer. That can be done in the implementation of ITcpMsgSessionHandler.

Public header files

cxMessage2