// If we receive any non ECONNREFUSED error, it means the port is used but we cannot connect if (err.code !== 'ECONNREFUSED') { returndoFindFreePort(startPort + 1, giveUpAfter - 1, clb); }
// Otherwise it means the port is free to use! returnclb(startPort); });