title: Connect to first free port with TCP using 0MQ
body: <p>I'm writing a distributed search algorithm in which agents need to listen on a TCP socket for incoming connections. At some point, the agent should bind a free TCP port. Port number is not important but agent should send his/her listening port number to other agents. </p>
  
  <p>I guess this is right way of doing:</p>
  
  <pre><code>socket.bind("tcp://*:0");
  </code></pre>
  
  <p>Socket binds successfully but then, how do I get the port number that socket's bound to? I can't see any option code in <code>zmq_getsockopt</code> man page returning a port number. </p>