In my application, I'm creating 2 sockets and have a try/except for this:
try:
socketA.connect("tcp://localhost:5557")
socketB.bind("tcp://localhost:5558")
except zmq.ZMQError as e:
if e.errno == zmq.EINVAL:
logger.error("Endpoint supplied is invalid")
else:
logger.error("The ZeroMQ error with an error number {0}".format(e.errno))
raise ZMQError(e)
cleanUp()
If for some reason, one of the sockets cannot .connect()/.bind(), I want to close both sockets and terminate the context in a cleanUp() function, but how will I know which sockets are alive before closing them?
Does ZeroMQ provide any information about active sockets before closing them nicely?