Reputation: 3432
Is it possible to use ZeroMQ as an intermediate point where different programs can send packets to an ip:port
combination or alternatively network interface and have ZeroMQ forward any such packets in a specific outbound connection?
So basically I don't want to send data generated by me programmatically but expose some endpoint for other applications to seamlessly communicate as they have always done, but by basically using ZeroMQ as a middleman that will route traffic accordingly.
Upvotes: 1
Views: 203
Reputation: 1
Q : "... have ZeroMQ forward any such packets in a specific outbound connection?"
Given there is a built-in way to avoid using any of the common ZeroMQ high-level Scalable Formal Communications Pattern Archetypes from the arsenal of { PUB/SUB | XPUB/XSUB | REQ/REP | XREQ/XREP | ROUTER/DEALER | PUSH/PULL | RADIO/DISH | CLIENT/SERVER | ... }
, there is a chance to use the "raw"-mode, where indeed a socket-FileDescriptor could start to get handled by the ZeroMQ instrumentation { .poll() | .send() | .recv() }
-methods.
For a success in your intended use-case to be achieved, yet there will be necessary to carefully follow the published API specification, as the ZMQ_STREAM
sockets have some built-in behaviours, that need to be reflected in your MiTM-proxy-processing ( strip-off prepended identity, added upon arrival, thread-safety, etc. ).
Anyway, while the core ZMQ-RFC documentation is stable, the API documentation reflects recent changes as the core library still keeps evolving, so keep a close look on what you implement (based on current version) and what to watch for potential further version evolutions and/or discontinued features.
There might be interesting to also harness the zmq_socket_monitor()
features, as you will be based on connection-oriented tcp://
-transport class in this scenario.
Upvotes: 1