getaport

get a free port, now!

npm install getaport
1 downloads in the last week
4 downloads in the last month

getaport

Get a random free tcp port.

Usage

var getaport = require('getaport');
getaport(function(err, port){ // get a tcp port for 0.0.0.0
  if(e) return console.error('oops!'); 
  console.log('got a port of ' + port);
});

getaport('127.0.0.1', function(err, port){ // get a tcp port for 127.0.0.1
  if(e) return console.error('oops!'); 
  console.log('got a port of ' + port);
});
npm loves you