getport
Find an open port to listen on.
Last updated 11 years ago by mikeal .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install getport 
SYNC missed versions from official npm registry.

getport

npm install getport

Find an open port to listen on.

`getport(function (e, port) {})``

var getport = require('getport')
getport(function (e, p) {
  if (e) throw e
  server.listen(p)
})

Note: getport uses a TCP client to check the ports and see if anyone has bound to them. If you do not have permission to bind to a port you may still get an error.

getport(start, function (e, port) {})

getport(5000, function (e, p) {
  if (e) throw e
  assert.equal(5000, p)
})

getport(start, end, function (e, port) {})

getport(6000, 5999, function (e, p) {
  assert.ok(e)
})

Current Tags

  • 0.1.0                                ...           latest (11 years ago)

1 Versions

  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |