Ashish wrote:
with prefixed string decoder. We have a length and then actual
messages. It will be worthwhile to explore if we can align the google
codec with prefixed string codec.
Almost all message-oriented protocols seem to have:
- a fixed length header containing a length, possibly implied
- the payload
I suspect that you can abstract most with a general binary framework that:
- defined the fixed length part
- registers a callback that can process the fixed length header and
return the payload length
- registers a callback that receives both the fixed length header and
the payload
The key is that the length need not be at the start of the header, and
may be computed.
The dificulty is deciding how to handle long payloads. It may be that
for long data
you should stream to a file and then pass header plus stream - but doing
so implies a
piecewise payload handler and that should probably be exposed too for
cases where
the application wishes to process as it goes.
James