[zeromq-dev] [Q] bind and connect multiple times

Martin Sustrik sustrik at 250bpm.com
Mon May 17 09:28:21 CEST 2010

Hi Chuck,

> So I was correct to assume that this doesn't make sense for all
> socket types. For example, there is no point in having a REQ socket
> connect to multiple addresses. It sends one request and expects a
> single reply. On the flip side, a REP socket only binds once and
> never calls connect on anything.

REQ socket can connect to multiple addresses. What happens then is that 
requests are load-balanced among the connections. In other words, your 
request is routed to the peer which is least loaded at the moment.

As for REP socket, it can be bound to multiple addresses. This is useful 
in heterogenous environment. Say you want to get requests from the 
processes on the same box using IPC transport and requests from remote 
applications using TCP. You bind your REP socket to both TCP and IPC 


Btw, Pieter, we have to discuss this issue in the instructional video we 
are up to make.

More information about the zeromq-dev mailing list