aze
aze

Reputation: 850

Python ZeroMQ : connecting two different clients together in a ROUTER and a REP configuration

I have a configuration with the following server/clients :

I want the server to be able to tell the real client to connect (directly or somehow through the server) to a websocket, opened on the worker client. But it seems, I cannot retrieve the worker's IP-address from a ZeroMQ socket.

How could I achieve this, without some dirty IP-address retrieve hacks?

Upvotes: 1

Views: 56

Answers (1)

user3666197
user3666197

Reputation: 1

How could I achieve this, without some dirty IP-address retrieve hacks?

The best would be to use an explicitly communicated IP-address dialogue / handshaking between the server and the worker which would take place upon their setup / initialisation, in which the worker adviced these configuration details to server, upon having been asked to provide a such answer.

Given that, the "new"-real-client .connect()-s it's REQ onto the server's REP, and asks the server about where to go next, the server thus can answer this and the "new"-real-client will get received this way a legitimate IP-address:port# and any additionally needed details for any additional TCP/IP-L3 service establishment and use.

That simple :o)


Design-side Epilogue:

Because there are some further, design-side implications, hardwired inside of each type of the ZeroMQ sockets' Access-Point, it might be found more appropriate to serve a separate REP-AccessPoint on the server side, so as not to subordinate each "new"-real-client to become dependent upon a presence of events outside of the domains of control of both the server and such "new"-real-client, but to rather allow both such REQ/REP-endpoints to enjoy the independence of anything but their temporally (semi-)private details (re-)negotiation(s).

Upvotes: 1

Related Questions