Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom array of ports #18

Closed
stevenvachon opened this issue Feb 19, 2014 · 2 comments
Closed

Custom array of ports #18

stevenvachon opened this issue Feb 19, 2014 · 2 comments

Comments

@stevenvachon
Copy link

Something like:

var ports = [ 80, 8080, 3000, 7000, 8000, 9000, 10000, 11000, 7777, 8888, 9999, 7070, 9090, 7007, 8008, 9009, 7700, 8800, 9900, 11000, 12100, 7770, 8880, 9990, 11100 ];

portscanner.findAPortNotInUse(ports, '127.0.0.1', function(error, port) {
  console.log('AVAILABLE PORT AT: ' + port)
})
@baalexander
Copy link
Owner

You should be able to just iterate over your array and call portscanner.checkPortStatus(port, '127.0.0.1')

Example:

var ports = [ 80, 8080, 3000, 7000, 8000, 9000, 10000, 11000, 7777, 8888, 9999, 7070, 9090, 7007, 8008, 9009, 7700, 8800, 9900, 11000, 12100, 7770, 8880, 9990, 11100 ];
ports.forEach(function(port) {
  portscanner.checkPortStatus(port, '127.0.0.1', function(error, status) {
    console.log('Port status', status);
  });
});

@stevenvachon
Copy link
Author

@baalexander How would that work? portscanner.checkPortStatus() is asynchronous and Array.prototype.forEach() is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants