Hi, I am trying to use a wildcard port in an effort to let the OS assign an ephemeral port. I then try to ascertain the actual endpoint by using the LAST_ENDPOINT socket option so that I can inform other apps of the real endpoint.
This is along the lines of the suggestion here: http://lists.zeromq.org/pipermail/zeromq-dev/2012-October/018915.html A simple script which demonstrates the problem is located in this gist: https://gist.github.com/4520939 The output I get when I run the script: Python version: 2.7.2 (default, Jun 20 2012, 16:23:33) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] zmq version: 3.2.2 pyzmq version: 2.2dev Endpoint is tcp://192.168.1.2:* Traceback (most recent call last): File "zmq_test.py", line 38, in <module> router.getsockopt(zmq.LAST_ENDPOINT) File "socket.pyx", line 394, in zmq.core.socket.Socket.getsockopt (zmq/core/socket.c:3915) zmq.core.error.ZMQError: Invalid argument zmq.LAST_ENDPOINT is an option listed in the constants module. Am I doing something wrong? Is there a better way to find the actual endpoint used when providing a wildcard port in the endpoint string to bind? I am aware that pyzmq has the bind_to_random_port function but that does not really fit my need exactly as that could potentially block for some extended period of time. In most cases it would likely be very short but I am trying to integrate ZMQ and Twisted together so I am trying to implement a solution that avoids blocking where ever possible. Regards, Chris
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
