src/index.js
function checkPort(port, host, callback) {
    var socket = new Socket(),
        status = null;
    socket.on('connect', () => {
        status = 'open';
        socket.end();
    });
    socket.setTimeout(1500);
    socket.on('timeout', () => {
        status = 'closed';
        socket.destroy();
    });
    socket.on('error', (exception) => {
        status = 'closed';
    });
    socket.on('close', (exception) => {
        callback(null, status,host,port);
    });
    socket.connect(port, host);
}
function checkPort(port, host, callback) {
    var socket = new Socket(),
        status = null;
    socket.on('connect', () => {
        status = 'open';
        socket.end();
    });
    socket.setTimeout(1500);
    socket.on('timeout', () => {
        status = 'closed';
        socket.destroy();
    });
    socket.on('error', (exception) => {
        status = 'closed';
    });
    socket.on('close', (exception) => {
        callback(null, status,host,port);
    });
    socket.connect(port, host);
}
function checkPort ( port , host , callback ) { var socket = new Socket ( ) , status = null ; socket . on ( 'connect' , ( ) => { status = 'open' ; socket . end ( ) ; } ) ; socket . setTimeout ( 1500 ) ; socket . on ( 'timeout' , ( ) => { status = 'closed' ; socket . destroy ( ) ; } ) ; socket . on ( 'error' , ( exception ) => { status = 'closed' ; } ) ; socket . on ( 'close' , ( exception ) => { callback ( null , status , host , port ) ; } ) ; socket . connect ( port , host ) ; }
Keep this function to use in a future version to port scan
Keep this function to use in a future version to port scan