[zeromq-dev] ROUTER-DEALER missing connects/messages.

Dowd, Brian Brian.Dowd at commerzbank.com
Tue Sep 25 17:23:19 CEST 2012


In the example in pastebin, lines:

35: - this is in the Client/DEALER part.
            // Option 2. Send a message through to connect fully.
            // socket.send("".getBytes(), 0);

and 72: in the server/ROUTER part
           // Option 2.
           // socket.send("".getBytes(), 0);

I tried this simple handshake, i.e. send something down the wire on each side.
I did also mess around with a send and recv on each side, but I could not get that
to work either (again I may have done something silly), I could not get my head around
how this woudl work for the underlying ephemeral socket though as the server side 
certianly coudl only do this once, it didn't make sense to me to try it for clients and
servers as the server only binds once ... or are you talking a more complex handshake
with a separate socket pair for REQ/REP ... if so again I dont quite understand why this 
shoudl be necessary and also I dont see how that coudl influence/fix an issue in 
another unrelated socket ....

-----Original Message-----
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Michel Pelletier
Sent: 25 September 2012 16:17
To: ZeroMQ development list
Subject: Re: [zeromq-dev] ROUTER-DEALER missing connects/messages.

Ah right, I shouldn't answer emails at 7:30 am.  I use Python
typically where the minutia of SND/RCVMORE is unnecessary.   Can you
elaborate on what "2. Send a message through on each side to complete the connection, does not fully work" means to you?  You should be able to synchronize the two processes with a simple handshake before starting the flow of messages.

-Michel

On Tue, Sep 25, 2012 at 8:05 AM, Dowd, Brian <Brian.Dowd at commerzbank.com> wrote:
> HI Michel,
>    Yes it is a multi-part message on the send side, however the first 
> part is just the identity/destination/address details (i.e. 
> client-1/client-2 etc), and the setIdentity() call in the "Client" 
> side of things associates thw two so that when the "client-1" is set 
> in the first part the ZMQ layer knows to send that message to the 
> "Client" that connected with identity "client-1" .... Also, just in case I did double check the rtdealer.c and it behaves exactly equivalently in that it does not loop as you suggest, but does it the same way as my java example more or less, I imagine looping woudl make sense when you are not using ROUTER/DEALER and do not know in advance how many parts there are ...
>
> I dont believe it is the issue here.
>
> Cheers,
> Brian
>
> -----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org 
> [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Michel 
> Pelletier
> Sent: 25 September 2012 15:36
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] ROUTER-DEALER missing connects/messages.
>
> It looks like you are sending a multi-part message but not receiving 
> it correctly.  I'm not java expert so perhaps I could be wrong about 
> how to recv a multi-part message in java, but in C you need to loop on
> recv() and check the socket option ZMQ_RCVMORE to know when to break.
>
> -Michel
>
> On Tue, Sep 25, 2012 at 6:51 AM, Dowd, Brian <Brian.Dowd at commerzbank.com> wrote:
>> Hi all,
>>
>>    I am trying to get a simple example ROUTER/DEALER working, but 
>> seem to be hitting a problem
>>
>> that I've seen referred to in a few places - basically that of 
>> los/missing messages.
>>
>>
>>
>> I need my clients (DEALERs) and server (ROUTER) to be able to stop & 
>> start independently .. they will be
>>
>> in separate processes.
>>
>>
>>
>> My ROUTER will be the server and there will be multiple 
>> DEALER-clients however I cannot do the Thread.sleep()
>>
>> that appears in the rtdealer example in my real production code.
>>
>>
>>
>> I've seen some traffic about it and tried some suggestions in my code
>> -
>>
>> 1. Thread.sleep() - from original rtdealer, works but not 
>> deterministically and cannot use in PROD.
>>
>> 2. Send a message through on each side to complete the connection, 
>> does not fully work.
>>
>>
>>
>> I've also seen some issues about it in the newsgroups, and am 
>> wondering if this is an issue with the
>>
>> later versions of zero mq... I don't know.
>>
>>
>>
>> http://article.gmane.org/gmane.network.zeromq.devel/13004
>>
>> http://thread.gmane.org/gmane.network.zeromq.devel/12967/focus=12982
>>
>> http://thread.gmane.org/gmane.network.zeromq.devel/11571
>>
>> http://article.gmane.org/gmane.network.zeromq.devel/12981/match=route
>> r
>> +dealer
>>
>>
>>
>> I also could not see a JIRA issue reported against exactly this 
>> behaviour, so perhaps I am doing something silly ....
>>
>>
>>
>> I am using java version 1.6.0-21 and ZMQ version version 3.2.0-rc1 as 
>> recommended for new projects.
>>
>> The OS is Windows x86 architecture.
>>
>>
>>
>> I have also run (not the example) a more comprehensive version on 
>> linux boxes, and they seem to work
>>
>> sometimes and not others (timing related) I believe it is the same 
>> problem that the example code illustrates,
>>
>> this is on i386/Linux.
>>
>>
>>
>> Here is a paste bin of my example code - http://pastebin.com/s1gJpcP9
>>
>>
>>
>> Any help very much appreciated.
>>
>>
>>
>> Cheers,
>>
>> Brian.
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
> _______________________________________________
> 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



More information about the zeromq-dev mailing list