I'm using ZMQ bindings in Python, and I want to bind clients to some port, and then send that location to other clients to connect. Now this is basic binding code:
subscriber = context.socket(zmq.SUB)
...
subscriber.bind("tcp://0.0.0.0:12345")
What I need to get is external address, not 0.0.0.0
, let say my pc has IP 192.168.1.10
, I need to get "tcp://192.168.1.10:12345" and send that to other clients, because sending tcp://0.0.0.0:12345
is useless.
How can I get external IP of interface that ZMQ used to create a socket?
There can be the number of NIC on pc, and if I just try to get external IP using normal socket it could be invalid, cause I don't know what NIC ZMQ used.