Created
May 13, 2012 03:11
-
-
Save loki42/2673589 to your computer and use it in GitHub Desktop.
zeromq bind to random port
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from gevent_zeromq import zmq | |
>>> context = zmq.Context() | |
>>> internal_socket = context.socket(zmq.PULL) | |
>>> internal_socket.bind_to_random_port("tcp://*") | |
59994 | |
>>> internal_socket.bind_to_random_port("tcp://localhost") | |
Traceback (most recent call last): | |
File "<input>", line 1, in <module> | |
File "/usr/local/lib/python2.7/dist-packages/zmq/core/pysocket.py", line 148, in bind_to_random_port | |
raise ZMQBindError("Could not bind socket to random port.") | |
ZMQBindError: Could not bind socket to random port. | |
>>> internal_socket.bind_to_random_port("tcp://127.1.1.0") | |
59965 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment