Hello---
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://1.2.3.4:*"
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:
tcp://*:*[50123-52123]
interpreted: bind to all interfaces; choose the first open port in the
range between 50123 and 52123.
tcp://*:![40000-50000]
interpreted: bind to all interfaces; choose a random port between
40-thousand
and 50-thousand.
This is done for both zsock and zsocket classes. Documentation updated.
Self-tests
added.
HUH? WHY did you do this? WHY the HECK would this be useful?
Short answers:
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
to
look for sockets would be at the beginning of the range 49152 to
64K. Why
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,
especially
if you request lots of ephemeral ports. Unless the range
is very crowded, "!" will most likely find a free port on the
first attempt.
I tested this code using some simple test sets.
Check it out! See: https://github.com/WyoMurf/czmq.git
murf
--
Steve Murphy
ParseTree Corporation
57 Lane 17
Cody, WY 82414
✉ murf at parsetree dot com
☎ 307-899-5535
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev