Cjen1
Cjen1

Reputation: 1746

Connect and Bind on same socket

I have a set of nodes running in a decentralised manner. Currently I am using one dealer socket for taking input in and one for outputting to the other nodes.

The one taking input is bound to a port, the other connects to the remainder.

I was wondering whether it is possible to roll both into one, bind to the port and connect to all the others:

socket = ...
socket.bind("tcp://*:5000")
for addr in other_endpoints:
  socket.connect(addr)

I'm expecting this to not be possible, but I'd be happily surprised if it is.

Upvotes: 0

Views: 542

Answers (1)

jamesdillonharvey
jamesdillonharvey

Reputation: 1042

Yes it is possible to bind and connect on a single socket. I have production systems running where a single socket binds over IPC and connects over PGM. The zeromq patterns do no care how (direction etc) the underlying connection was established.

Upvotes: 1

Related Questions