JustinTulloss/zeromq.node — pull request #162 by ronkorving (2012-12-04 06:35:29+00:00)
Title: ZMQ_LAST_ENDPOINT for automatic port assignment

ZeroMQ 3.2 introduced the ZMQ_LAST_ENDPOINT option. It returns the URI when getsockopt is called right after binding. It allows the following code to work:

```js
var zmq = require('zmq');
var sock = zmq.createSocket('xrep');
var res = sock.bindSync('tcp://*:*');
console.log('last endpoint:', sock.getsockopt('last_endpoint'));
```

It will print (random port assigned each time):

`last endpoint: tcp://0.0.0.0:42102`