For this very purpose let me direct your kind attention first to the concept:
- ZeroMQ Hierarchy in Less than Five Seconds
as have been done in an answer to your previous ZeroMQ-related question.
If you try to make a local resource manager ( right, The Context()
-instance ) to .bind()
onto a resource, that is non-local ( in case the tcp://140.93.0.95:5678
-target is not any of the localhost interfaces ), the result must fail to work as there is none such Context()
that could grab a non-local ( foreign, remote O/S owned and managed ) resource and use it. Pirates used to execute such a wild strategy to grab a foreign owned resource ( ship, gold, you name it all ) yet that practice was definitely not considered fair, nor polite, the less legal.
If you try the same, while the target-IP-address in the .bind()
method is local, then your code is fair to ask for using a local-resource ( one of the localhost's interfaces, get it equipped with a tpc://
protocol data-pump ), yet your code has run into another sort of problems, related to the resources handling. Here it seems that the O/S has rejected such fair-in-a-shape request, due to wrong time to ask for having it, as the O/S has not considered the requested target being "free-to-use", most probably due to a colliding use ( if some other application has successfully acquired a use of that resource and has not released it yet back to the O/S ) or due to a post-mortem locked use of that resource, which may happen if previous ZeroMQ-application run(s) did not gracefully .close()
-ed and .term()
-ed any of the Context()
-instances, which may still keep this resource (dead-)locked due to their wrong resource-handling/release policies.
This is a long story, yet it gets quite often onto the table, if unhandled exceptions are let to leave crashed instances that still "hold" ip-address(es) in use and cannot help themselves, as the already crashed application code cannot and will not make them release their .bind()
-acquired address. Infinite ( until reboot ) semi-(dead-)lock cases are not seldom to experience, if due care is not put into the crash-proof code-designs and the locked-resources are a mildest "punishment" for such designer's sins.