find-free-port-sync.js
function FindFreePortSync(options = {}) {
    this.defaultOptions = {
        // port start for scan
        start: 1,
        // port end for scan
        end: 65534,
        // ports number for scan
        num: 1,
        // specify ip for scan
        ip: '0.0.0.0|127.0.0.1',
        // for inner usage, some platforms like darkwin shows commom address 0.0.0.0:10000 as *.10000
        _ipSpecial: '\\*|127.0.0.1',
        // scan this port
        port: null
    };

    this.msg = {
        error: 'Cannot find free port'
    }

    this.adjustOptions(options);
}
function FindFreePortSync(options = {}) {
    this.defaultOptions = {
        // port start for scan
        start: 1,
        // port end for scan
        end: 65534,
        // ports number for scan
        num: 1,
        // specify ip for scan
        ip: '0.0.0.0|127.0.0.1',
        // for inner usage, some platforms like darkwin shows commom address 0.0.0.0:10000 as *.10000
        _ipSpecial: '\\*|127.0.0.1',
        // scan this port
        port: null
    };

    this.msg = {
        error: 'Cannot find free port'
    }

    this.adjustOptions(options);
}
function FindFreePortSync ( options = { } ) { this . defaultOptions = { // port start for scan start : 1 , // port end for scan end : 65534 , // ports number for scan num : 1 , // specify ip for scan ip : '0.0.0.0|127.0.0.1' , // for inner usage, some platforms like darkwin shows commom address 0.0.0.0:10000 as *.10000 _ipSpecial : '\\*|127.0.0.1' , // scan this port port : null } ; this . msg = { error : 'Cannot find free port' } this . adjustOptions ( options ) ; }
Finding free port synchronously
@param {Object} options [description]
Finding free port synchronously