Please take my advice. In future releases your PUSH -> ROUTER code will break. 
It is not correct, so you will need to fix it. It works now due to a bug in the 
library.

The DEALER socket can be used in place of the PUSH socket. You may leave your 
REQ socket code unchanged. 

To use DEALER in place of PUSH, I believe all you will need to do is send a 
null message part as your first message part. That is, if you are currently 
sending one message part then now you will send two (first part is null, second 
message part is message body). This is not a difficult change.

cr

On Nov 13, 2012, at 12:21 PM, Ilja Golshtein <[email protected]> wrote:

> 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" <[email protected]>:
>> 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 <[email protected]> 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
>>>  [email protected]
>>>  http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> 
>> _______________________________________________
>> zeromq-dev mailing list
>> [email protected]
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> -- 
> Best regards
> Ilja Golshtein
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to