[zeromq-dev] Idea: custom encoder/decoder for STREAM sockets

Goswin von Brederlow goswin-v-b at web.de
Sat Feb 1 17:52:37 CET 2014

On Sat, Feb 01, 2014 at 04:00:57PM +0100, Diego Duclos wrote:
> I'm not sure this fits into zmq itself ? It should already be possible to
> build this on top of a ØMQ socket without too much issues (any socket type,
> really).
> On Sat, Feb 1, 2014 at 3:44 PM, Goswin von Brederlow <goswin-v-b at web.de>wrote:
> > On Sat, Feb 01, 2014 at 08:32:08AM -0500, Lindley French wrote:
> > > This approach might allow seamless integration of forward error
> > correction libraries as well.
> >
> > Wouldn't you want to use that with any socket type? That would mean
> > encoding/decoding gets stacked one on top of the other. Probably a
> > larger change.
> >
> > MfG
> >         Goswin

I think it is possible by creating an aggregation thread and handle
this on the application side.

The aggregation thread would have 2 sockets, one STREAM and one DEALER
or ROUTER I think. It would read from the STREAM socket, parse the
incoming data and buffer it, one buffer per connection. Then, in the
HTTP case, when it finds the \r\n\r\n that ends a request is would
send the request as single message to the DEALER socket.

But that adds quite a bit of overhead and needs a lot of error
handling. Not to mention handling connection and disconnection
notification and the faking a monitoring socket.


More information about the zeromq-dev mailing list