[zeromq-dev] Using zmq_proxy with ZMQ_STREAM socket

Kil Tuy kiltuy1 at gmail.com
Mon Apr 6 10:29:06 CEST 2015


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150406/34767e7f/attachment.htm>


More information about the zeromq-dev mailing list