[zeromq-dev] PUSH/ROUTER

Ilja Golshtein ilejncs at narod.ru
Tue Nov 13 19:21:36 CET 2012


Chuck,

yes, some clients need replies (and use REQ), other do not (and use PUSH).

I am aware of DEALER and I understand that it is proper (at least documented)
way to accomplish my goal, but 
1. REQ and PUSH look more natural and elegant than all this fuss with DEALER.
2. I have some already developed clients use PUSH and would prefer to keep the code intact.

That is why I wonder if it is eligible to pair PUSH and ROUTER sockets.

Thanks.

13.11.2012, 20:33, "Chuck Remes" <lists at chuckremes.com>:
> No, you should not use PUSH and ROUTER together. Your use-case mentions that *some* clients need to send a reply. A PUSH socket is send-only so you would never be able to receive those replies.
>
> I recommend that you use DEALER and ROUTER sockets for your use-case. See this article for some important details.
>
> http://www.zeromq.org/tutorials:dealer-and-router
>
> There is no requirement that a ROUTER socket must reply to a DEALER socket. You could have 95% of communications be unidirectional and the 5% that require replies would be bidirectional.
>
> Perhaps you would like to explain your requirements in more detail and we can provide more guidance on socket and pattern choice.
>
> cr
>
> On Nov 13, 2012, at 10:22 AM, Ilja Golshtein <ilejncs at narod.ru> wrote:
>
>>  Hello, List!
>>
>>  Is it eligible to pair PUSH and ROUTER sockets?
>>
>>  I have clients send requests require answers and
>>  clients who send some data to server and do not expect a response.
>>  It seems technically possible to have either PUSH or REQ at client side
>>  and serve both types of input by ROUTER socket.
>>
>>  When ROUTER receives data, it looks like
>>  routing parts, then empty part, then application data in case of REQ and
>>  routing parts (which is useless) just before application data in case of PUSH.
>>  Assuming the first application part is not empty, everything seems Ok.
>>
>>  Advantages
>>  1. No poll at server side.
>>  2. One TCP port to open and to keep in mind.
>>
>>  Caveats?
>>
>>  zeromq 2.2, linux.
>>
>>  --
>>  Best regards
>>  Ilja Golshtein
>>  _______________________________________________
>>  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

-- 
Best regards
Ilja Golshtein



More information about the zeromq-dev mailing list