[zeromq-dev] Multiplexing a TCP endpoint

Michal Vyskocil michal.vyskocil at gmail.com
Wed Feb 10 20:25:42 CET 2016


Hi,

In case you want to play even more, there is malamute broker. It can listen
in tcp socket and you can filter incoming messages per stream or subject.

The disadvantage is you must use mlm client API to make it work. However
sounds like right tool for your use case.
Dne 10. 2. 2016 8:12 PM napsal uživatel "Tom Quarendon" <
tom.quarendon at teamwpc.co.uk>:

> This is what "resources" in ZMTP 3.1 were designed for. No implementation
> yet though (see other discussion on his list) :-)
>
> You would have to write the proxy loop yourself. So do a select on the
> external socket and all the internal sockets and know that when you pull a
> message from the external socket that you peel off the first frame after
> the delimiter, then use the service name it includes to pick which internal
> socket to pass the rest of the message to. The services then run
> independently on their own inproc (or even out of process on ipc or tcp)
> sockets. It's what I would end up doing to do the same thing.
>
> Hope that helps.
>
> -----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org [mailto:
> zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Alex Bligh
> Sent: 10 February 2016 17:24
> To: zeromq-dev at lists.zeromq.org
> Cc: Alex Bligh <alex at alex.org.uk>
> Subject: [zeromq-dev] Multiplexing a TCP endpoint
>
> I am investigating building a zeromq-based application which runs over
> TCP. It will run many separate services over zeromq, mostly REP/REQ (via
> proxies), but also PUB/SUB.
>
> The normal way to do this as far as I can tell is to use one TCP port per
> service. I want to avoid doing this, as the services can be dynamically
> created and deleted and I don't want to be bothered with different firewall
> rules, port management etc.
>
> For inproc communication that's fine, as I can specify a unique name.
> However, the TCP endpoint does not have this. Only one socket can bind to a
> tcp port.
>
> What I'd really like to do is simply to multiplex (by service name)
> multiple services (i.e. multiple sockets) onto the same TCP port. They
> would then pass like shadows in the night. I would like this to
> transparently work with encryption too.
>
> I think this would be no harder than adding an additional frame (the
> service name) on send, and stripping it on receive. However, I can't
> immediately see how to do this using standard Router / Dealer code (partly
> because I'd have to somehow route the messages to the correct endpoints
> that had 'connected'), though I may be missing something. In many ways it
> would seem to be easier to modify the endpoint protocol.
>
> Am I missing something? Am I approaching this the right way?
>
> --
> Alex Bligh
>
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160210/463edbbb/attachment.htm>


More information about the zeromq-dev mailing list