How to use portscanner - 10 common examples

To help you get started, we’ve selected a few portscanner examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
assert(error === null);
    if (error) assert(error.message === '');
    assert(port === 3005);
};

const assertPort = (port: number) => {
    assert(port === 3005);
};

// one argument
findAPortNotInUse([3000, 3005, 3006]).then(assertPort);
findAPortNotInUse(3000).then(assertPort);

// two arguments
findAPortNotInUse([3000, 3005, 3006], findPortCallback);
findAPortNotInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortNotInUse(3000, findPortCallback);
findAPortNotInUse(3000, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010).then(assertPort);

// three arguments
findAPortNotInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortNotInUse(3000, 3010, '127.0.0.1', findPortCallback);

// one argument
findAPortInUse([3000, 3005, 3006]).then(assertPort);
findAPortInUse(3000).then(assertPort);
github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
const assertPort = (port: number) => {
    assert(port === 3005);
};

// one argument
findAPortNotInUse([3000, 3005, 3006]).then(assertPort);
findAPortNotInUse(3000).then(assertPort);

// two arguments
findAPortNotInUse([3000, 3005, 3006], findPortCallback);
findAPortNotInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortNotInUse(3000, findPortCallback);
findAPortNotInUse(3000, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010).then(assertPort);

// three arguments
findAPortNotInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortNotInUse(3000, 3010, '127.0.0.1', findPortCallback);

// one argument
findAPortInUse([3000, 3005, 3006]).then(assertPort);
findAPortInUse(3000).then(assertPort);

// two arguments
findAPortInUse([3000, 3005, 3006], findPortCallback);
findAPortInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);
github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
checkPortStatus(3000, '127.0.0.1', { timeout: 400 }).then(assertStatus);
checkPortStatus(3000, '127.0.0.1', { timeout: 400 }, checkPortCallback);

const findPortCallback = (error: Error | null, port: number) => {
    assert(error === null);
    if (error) assert(error.message === '');
    assert(port === 3005);
};

const assertPort = (port: number) => {
    assert(port === 3005);
};

// one argument
findAPortNotInUse([3000, 3005, 3006]).then(assertPort);
findAPortNotInUse(3000).then(assertPort);

// two arguments
findAPortNotInUse([3000, 3005, 3006], findPortCallback);
findAPortNotInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortNotInUse(3000, findPortCallback);
findAPortNotInUse(3000, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010).then(assertPort);

// three arguments
findAPortNotInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortNotInUse(3000, 3010, '127.0.0.1', findPortCallback);
github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
assert(status === 'closed');
};

checkPortStatus(3000).then(assertStatus);

checkPortStatus(3000, '127.0.0.1').then(assertStatus);
checkPortStatus(3000, { host: '127.0.0.1' }).then(assertStatus);
checkPortStatus(3000, { timeout: 400 }).then(assertStatus);
checkPortStatus(3000, checkPortCallback);

checkPortStatus(3000, { host: '127.0.0.1' }, checkPortCallback);
checkPortStatus(3000, { timeout: 400 }, checkPortCallback);
checkPortStatus(3000, '127.0.0.1', checkPortCallback);

checkPortStatus(3000, '127.0.0.1', { timeout: 400 }).then(assertStatus);
checkPortStatus(3000, '127.0.0.1', { timeout: 400 }, checkPortCallback);

const findPortCallback = (error: Error | null, port: number) => {
    assert(error === null);
    if (error) assert(error.message === '');
    assert(port === 3005);
};

const assertPort = (port: number) => {
    assert(port === 3005);
};

// one argument
findAPortNotInUse([3000, 3005, 3006]).then(assertPort);
findAPortNotInUse(3000).then(assertPort);

// two arguments
github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
// three arguments
findAPortNotInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortNotInUse(3000, 3010, '127.0.0.1', findPortCallback);

// one argument
findAPortInUse([3000, 3005, 3006]).then(assertPort);
findAPortInUse(3000).then(assertPort);

// two arguments
findAPortInUse([3000, 3005, 3006], findPortCallback);
findAPortInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortInUse(3000, findPortCallback);
findAPortInUse(3000, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010).then(assertPort);

// three arguments
findAPortInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortInUse(3000, 3010, '127.0.0.1', findPortCallback);
github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
findAPortNotInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortNotInUse(3000, 3010, '127.0.0.1', findPortCallback);

// one argument
findAPortInUse([3000, 3005, 3006]).then(assertPort);
findAPortInUse(3000).then(assertPort);

// two arguments
findAPortInUse([3000, 3005, 3006], findPortCallback);
findAPortInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortInUse(3000, findPortCallback);
findAPortInUse(3000, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010).then(assertPort);

// three arguments
findAPortInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortInUse(3000, 3010, '127.0.0.1', findPortCallback);
github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
findAPortNotInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortNotInUse(3000, 3010, '127.0.0.1', findPortCallback);

// one argument
findAPortInUse([3000, 3005, 3006]).then(assertPort);
findAPortInUse(3000).then(assertPort);

// two arguments
findAPortInUse([3000, 3005, 3006], findPortCallback);
findAPortInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortInUse(3000, findPortCallback);
findAPortInUse(3000, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010).then(assertPort);

// three arguments
findAPortInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortInUse(3000, 3010, '127.0.0.1', findPortCallback);
github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
findAPortInUse(3000).then(assertPort);

// two arguments
findAPortInUse([3000, 3005, 3006], findPortCallback);
findAPortInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortInUse(3000, findPortCallback);
findAPortInUse(3000, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010).then(assertPort);

// three arguments
findAPortInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortInUse(3000, 3010, '127.0.0.1', findPortCallback);
github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
findAPortNotInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortNotInUse(3000, findPortCallback);
findAPortNotInUse(3000, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010).then(assertPort);

// three arguments
findAPortNotInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortNotInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortNotInUse(3000, 3010, '127.0.0.1', findPortCallback);

// one argument
findAPortInUse([3000, 3005, 3006]).then(assertPort);
findAPortInUse(3000).then(assertPort);

// two arguments
findAPortInUse([3000, 3005, 3006], findPortCallback);
findAPortInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortInUse(3000, findPortCallback);
findAPortInUse(3000, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010).then(assertPort);

// three arguments
findAPortInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortInUse(3000, 3010, '127.0.0.1', findPortCallback);
github DefinitelyTyped / DefinitelyTyped / types / portscanner / portscanner-tests.ts View on Github external
// one argument
findAPortInUse([3000, 3005, 3006]).then(assertPort);
findAPortInUse(3000).then(assertPort);

// two arguments
findAPortInUse([3000, 3005, 3006], findPortCallback);
findAPortInUse([3000, 3005, 3006], '127.0.0.1').then(assertPort);

findAPortInUse(3000, findPortCallback);
findAPortInUse(3000, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010).then(assertPort);

// three arguments
findAPortInUse(3000, 3010, '127.0.0.1').then(assertPort);
findAPortInUse(3000, 3010, findPortCallback);

// four argumentss
findAPortInUse(3000, 3010, '127.0.0.1', findPortCallback);

portscanner

Asynchronous port scanner for Node.js

MIT
Latest version published 6 years ago

Package Health Score

71 / 100
Full package analysis