port-pool

1.0.2 • Public • Published

Port Pool

This module can create a port pool and return the next free port on request. Ports are not reserved at system level. Port will be checked automatically. On every request the full pool is checked again (this means ports will be recycled when they are free again).

Creating a pool

Creating a pool happens in the constructor, like so:

var portPool = new PortPool(5000, 6000);

Requesting a free port

To request a free port simply call the "getNext" function:

portPool.getNext(function(port) {
	// port is the port number
	// port is null when no free port is found
});

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i port-pool

    Weekly Downloads

    2

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    30 kB

    Total Files

    11

    Last publish

    Collaborators

    • ultimate-tester