[zeromq-dev] Using zmq_proxy with ZMQ_STREAM socket
Pieter Hintjens
ph at imatix.com
Mon Apr 6 11:56:08 CEST 2015
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
>
More information about the zeromq-dev
mailing list