[Haskell-cafe] Protocol buffer network examples

Mads Lindstrøm mads.lindstroem at gmail.com
Tue Oct 12 16:35:28 EDT 2010


I am trying to read and write delimited messages[3] using
protocol-buffers [1,2] over a socket. I have managed to write delimited
messages and I was looking for examples of reading delimited messages.
Maybe somebody has an example of reading delimited messages from a

The Haskell protocol-buffer[1] package mostly uses bytestrings, but I
need to read from a socket. Of cause, I can use the bytestring package
to read X number of bytes from a socket-handle. But it is impossible to
know what X is, before you start parsing the message, as even integers
are variable length in protocol buffers.

Hope somebody can help,

Mads Lindstrøm

[1] http://hackage.haskell.org/package/protocol-buffers

[2] http://code.google.com/p/protobuf/

[3] Delimited messages is a protocol buffers technique, where one writes
the size of the message before the actual message:

More information about the Haskell-Cafe mailing list