[zeromq-dev] DEALER<->DEALER, do both ends connect?
Benson Margulies
benson at dchbk.us
Wed Apr 1 23:52:32 CEST 2015
I'm going to be really inappropriate and hijack my thread, I promise
never to do it again. I am very grateful that you answered this
question. Is there something I could do that would raise the
likelihood of getting an answer to my prior question about getting
-1/EAGAIN from zmq_send in a condition where, as i read the doc, I'd
expect to get blocking?
On Wed, Apr 1, 2015 at 1:17 PM, Shon Love <slove at fatpot.com> wrote:
> Hey,
>
> For peer-to-peer configurations, I've taken to having all peers create a PULL socket, which they bind and advertise to the rest of the peers. Then each peer creates a PUSH socket, which they connect to every other peer's PULL socket. I prefix all messages sent with the local peer's arbitrary id as the first frame, so the PULL sockets treat incoming messages like they were from a ROUTER (first frame is the sender's id). As part of the peer advertising step (multicast UDP w/ SSDP-like protocol), each peer includes it's id in association with the advertised PULL (bound) socket - this allows each peer to know which PUSH socket to use in sending peer response messages.
>
> This setup makes it easy to get all the peers connected and communicating w/o stressing over the bind/connect order.
>
> Hope that makes sense . . .
>
> Thanks,
> Shon
>
> -----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter Hintjens
> Sent: Wednesday, April 01, 2015 10:41 AM
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] DEALER<->DEALER, do both ends connect?
>
> One end binds, one end connects. If you do both, it will partially work, and create two pipes between the sockets, that is, two TCP connections. The results will be weird. You'll get messages swapping order randomly. Connect one, bind the other, and it'll work as you expect.
>
> -Pieter
>
> On Wed, Apr 1, 2015 at 7:39 AM, Leonard Michelet <leonard.michelet at openwide.fr> wrote:
>> I am using a DEALER-DEALER connection binding one, connecting the other. And it works fine.
>> In the ZeroMQ guide, there is a section about DEALER-DEALER connection, saying it's useful for full async communication as long as there is only 2 sockets communicating.
>> That's how I use it.
>>
>> ----- Mail original -----
>>> De: "Benson Margulies" <bimargulies at gmail.com>
>>> À: zeromq-dev at lists.zeromq.org
>>> Envoyé: Mercredi 1 Avril 2015 01:50:58
>>> Objet: [zeromq-dev] DEALER<->DEALER, do both ends connect?
>>>
>>> I am arranging bidirectional async traffic by connecting two DEALERS.
>>>
>>> I convinced myself that each end needed to both bind and connect.
>>>
>>> Is this excessive? Can it break something?
>>> _______________________________________________
>>> 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