[zeromq-dev] Binding to TCP port 0

Pierre Ynard linkfanel at yahoo.fr
Wed Jan 25 15:58:37 CET 2012


I want to bind a zeromq socket to an available TCP port assigned by the
OS. However the standard way of doing this, binding to port 0, fails
with EINVAL. Indeed, there is a check in the code saying that 0 is not a
valid port. Is there any reason for this? Is there another way of doing

Also it would be useful to have a way to fetch the port number that was
assigned, although personally I can live without it.


Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."

More information about the zeromq-dev mailing list