MCPcopy Create free account
hub / github.com/Marus/cortex-debug / findFreePorts

Function findFreePorts

src/common.ts:499–506  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

497export function getAnyFreePort(preferred: number): Promise<number> {
498 return new Promise(async (resolve, reject) => {
499 function findFreePorts() {
500 const portFinderOpts = { min: 60000, max: 62000, retrieve: 1, consecutive: false };
501 TcpPortScanner.findFreePorts(portFinderOpts, GDBServer.LOCALHOST).then((ports) => {
502 resolve(ports[0]);
503 }).catch((e) => {
504 reject(e);
505 });
506 }
507
508 if (preferred > 0) {
509 TcpPortScanner.isPortInUseEx(preferred, GDBServer.LOCALHOST, TcpPortScanner.AvoidPorts).then((inuse) => {

Callers 1

getAnyFreePortFunction · 0.85

Calls 1

findFreePortsMethod · 0.45

Tested by

no test coverage detected