-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathportScan2.js
More file actions
23 lines (17 loc) · 815 Bytes
/
Copy pathportScan2.js
File metadata and controls
23 lines (17 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var portscanner = require('portscanner');
var http = require('http');
// ////// Checks the status of a single port
// portscanner.checkPortStatus(8000, '127.0.0.1', function(error, status) {
// ///// Status is 'open' if currently in use or 'closed' if available
// console.log(status)
// })
//// Find the first available port. Asynchronously checks, so first port
// //// determined as available is returned.
// portscanner.findAPortNotInUse(3000, 8000, '127.0.0.1', function(error, port) {
// console.log('AVAILABLE PORT AT: ' + port)
// })
// //// Find the first port in use or blocked. Asynchronously checks, so first port
// //// to respond is returned.
// portscanner.findAPortInUse(3000, 9000, '127.0.0.1', function(error, port) {
// console.log('PORT IN USE AT: ' + port)
// })