MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / probeFreePort

Function probeFreePort

scripts/probe-port.ts:18–23  ·  view source on GitHub ↗
(start: number, end: number = start + 100)

Source from the content-addressed store, hash-verified

16 * @throws if no port in `[start, end]` is available.
17 */
18export async function probeFreePort(start: number, end: number = start + 100): Promise<number> {
19 for (let port = start; port <= end; port++) {
20 if (await isPortFree(port)) return port
21 }
22 throw new Error(`probeFreePort: no free port in range ${start}..${end}`)
23}
24
25/**
26 * A port only counts as free when BOTH the v4 wildcard (0.0.0.0) and the

Callers 2

probe-port.spec.tsFile · 0.70
claimFunction · 0.50

Calls 1

isPortFreeFunction · 0.70

Tested by

no test coverage detected