[zeromq-dev] Using zmq_proxy with ZMQ_STREAM socket
Kil Tuy
kiltuy1 at gmail.com
Mon Apr 6 12:20:58 CEST 2015
I am trying to replace existing adhoc pub/sub mechanism with zeromq.
Unfortunately clients are not in my control so I cannot plugin SUB sockets.
I thought I could bridge the gap using STREAM socket.
2015-04-06 12:56 GMT+03:00 Pieter Hintjens <ph at imatix.com>:
> This won't work, no. The STREAM socket will accept many client
> connections. You have to manage these in some way. There's not even a
> sane meaning to bridging a SUB socket to a STREAM socket afaict, it's
> like connecting a radio loudspeaker to a garden hose. What are you
> actually trying to do?
>
> -Pieter
>
> On Mon, Apr 6, 2015 at 10:29 AM, Kil Tuy <kiltuy1 at gmail.com> wrote:
> > Hi,
> > Is it possible to use ZMQ_STREAM with proxy? The idea is to have proxy a
> SUB
> > socket with a STREAM one. Following is what's working for me currently
> but I
> > am looking forward to replace it with proxy. Sorry that the code is
> written
> > using CLR binding.
> >
> > // Create subscriber
> > ZSocket sub = new ZSocket(ctx, ZSocketType.SUB);
> > sub.Connect("tcp://127.0.0.1:5564");
> > sub.SubscribeAll();
> >
> > // Create streamer
> > ZSocket stream = new ZSocket(ctx, ZSocketType.STREAM);
> > stream.Bind("tcp://127.0.0.1:5565");
> >
> > // Read client connect message
> > ZMessage msg = stream.ReceiveMessage();
> >
> > while (true)
> > {
> > // Forward message with a replaced id frame
> > ZMessage zm = sub.ReceiveMessage();
> > zm.ReplaceAt(0, msg[0]);
> > stream.Send(zm);
> > }
> >
> > /*ZContext.Proxy(stream, sub);*/
> >
> > I tried using proxy method but it didn't work. Possible to replace the
> > above code with proxy?
> >
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150406/dfc9f2aa/attachment.htm>
More information about the zeromq-dev
mailing list