[zeromq-dev] subports

Maciej Gajewski maciej.gajewski0 at gmail.com
Wed Jul 27 10:33:05 CEST 2011


What is the rationale for this feature?

It is something that could be easily implemented on top of 0MQ using
normal tcp transport, while still being transparent for the
application.

> Hi all,
>
> The subport feature (multiplexing several connections on top of the same
> TCP port) have been asked for a long time.
>
> I've committed the initial version of the functionality to "vtcp" branch
> in libzmq repo. It's still a bit creaky, but it should work at least on
> POSIX-compliant systems.
>
> How it works
> ------------
>
> There's "vtcp" project that deals with TCP port multiplexing. Note that
> it is not 0MQ-specific. It can multiplex connections from any applications.
>
> Technically, there's "vtcpd" deamon that listens on a specific TCP port
> and dispatches new connections to the applications on the local box
> based on the subport number.
>
> Applications (including 0MQ) use libvtcp library to bind/connect to vtcp
> subports.
>
> In wire-protocol terms, vtcp requires that 32-bit network-byte-ordered
> integer (subport number) is sent by the connecting side immediately
> after creating the TCP connection.
>
> Usage
> -----
>
> 1. Get vtcp project here:
>
>     https://github.com/sustrik/vtcp
>
> 2. Build and isntall it:
>
>     ./autogen.sh
>     ./configure
>     make
>     sudo make install
>
> 3. Get 0MQ from libzmq repo, vtcp branch
> 4. Build it with --with-vtcp option:
>
>     ./autogen.sh
>     ./configure --with-vtcp
>     make
>     sudo make install
>
> 5. Run the vtcp deamon on the port you want to multiplex:
>
>     vtcpd 5555
>
> 6. Test it using 0MQ perf tests:
>
>     local_lat vtcp://*:5555.123 1 1
>
>     remote_lat vtcp://127.0.0.1:5555.123 1 1
>
> Please note that vtcp only allows binding to *all* the network
> interfaces (*). Trying to bind to a specific interface will produce error.
>
> Question
> --------
>
> Addresses like "vtcp://127.0.0.1:5555.123" are annoyingly long. Would it
> make sense to use a well-know fixed port (such as 5555) for
> multiplexing? That way the address could be shortned to
> "vtcp://127.0.0.1:123"
>
> Any feedback is welcome.
>
> Martin



More information about the zeromq-dev mailing list