1

Is there any way to have an asynchronous client and server in ZeroMQ, using the same TCP-port and many sockets?

I already tried the ROUTER/ROUTER pattern, but with no luck.

The plan is to have an asymmetric connection with send and receive patterns among processors. So a Processor-entity will be a Client and also be a Server at the same time.

user3666197
  • 1
  • 6
  • 50
  • 92
ssavva05
  • 114
  • 3
  • 14

1 Answers1

1

Is there any way to have an asynchronous client and server in ZeroMQ, using the same TCP-port and many sockets ?

Yes, there is.

As a preventive step, in other words, before getting into troubles, best review the main conceptual differences in [ ZeroMQ hierarchy in less than a five seconds ] or other posts and discussions here.

The Yes above means, one-.bind()-many-.connect()-s, which composition still uses a just one <transport-class>://<a-class-specific-address>, that for a tcp:// transport-class on IPv4 means that one tcp://A.B.C.D:port# occupied for this whole 1:MANY-sockets-composition.

For obvious reasons, more complex compositions, like many-.bind()-s-many-.connect()-s, are possible, where feasible, given both the ZeroMQ infrastructure topology options and also socket-"in-band"-message-routing features are thus setup and used for smart-decisions on actual message-flow mechanics.

user3666197
  • 1
  • 6
  • 50
  • 92
  • Great! Thanks for your great explanation and fast response! God bless you! – ssavva05 May 23 '18 at 07:49
  • So, must I use Router-Router pattern or Dealer- Router pattern? – ssavva05 May 23 '18 at 08:01
  • Without any details, only you know what the { functional, non-functional }-requirements, resources and business-context are, anybody else simply could not see inside your brain, could she/he? Have you read the published API details, best preceded with the indepth Pieter HINTJENS evangelisation of the ZeroMQ zen-of-zero, as published in his book "Code Connected, Volume1"? Definitely worth one's time, if serious into distributed-systems design best practices. – user3666197 May 23 '18 at 11:51