[zeromq-dev] DEALER<->DEALER, do both ends connect?
Shon Love
slove at fatpot.com
Wed Apr 1 19:17:07 CEST 2015
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
More information about the zeromq-dev
mailing list