Is there a way to see which port a ZeroMQ (actually pyzmq) port is connected to after connecting?
For example...
import zmq
context = zmq.Context()
socket = context.socket(zmq.PAIR)
port = socket.bind_to_random_port("tcp://*")
# some other code that might change that binding
actual_port = socket.which_port???() # (this is what I want)
Could not find in documentation or other forums. Would have helped save me some debugging time!
```
The
.bind_to_random_port()method will automatically pick a port to bind to and the return will contain the port it bound too. The return is anint.