
Hi 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 socket? 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: http://code.google.com/apis/protocolbuffers/docs/techniques.html#streaming