[zeromq-dev] An extension to CZMQ for ephemeral ports
murf at parsetree.com
Mon Aug 25 08:10:04 CEST 2014
I've got a fork of czmq wherein I added code to give developers
a little more control over "ephemeral" ports. (You know, where
port is specified as "*" in "tcp://18.104.22.168:*"
Normally, the * notation for a port means for the software to
pick the first free port in the range C000 to FFFF (49152 to 65535. iirc).
With this extension, you can now say:
interpreted: bind to all interfaces; choose the first open port in the
range between 50123 and 52123.
interpreted: bind to all interfaces; choose a random port between
This is done for both zsock and zsocket classes. Documentation updated.
HUH? WHY did you do this? WHY the HECK would this be useful?
a. I'm a crazy guy doing crazy things.
b. Someday, maybe, maybe not, someone might have a cool, nifty zero-day
exploit against zeromq sockets. They might even know the best place
look for sockets would be at the beginning of the range 49152 to
make it easy for them to find your sockets?
c. Random port assignments (in this case, using the "!" instead of "*",
might be a little faster than the "first free port" search,
if you request lots of ephemeral ports. Unless the range
is very crowded, "!" will most likely find a free port on the
I tested this code using some simple test sets.
Check it out! See: https://github.com/WyoMurf/czmq.git
57 Lane 17
Cody, WY 82414
✉ murf at parsetree dot com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the zeromq-dev