MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / freePortPair

Function freePortPair

packages/simdeck-test/src/index.ts:843–851  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

841}
842
843async function freePortPair(): Promise<number> {
844 for (let attempt = 0; attempt < 100; attempt += 1) {
845 const port = await freePort();
846 if (port < 65535 && (await portAvailable(port + 1))) {
847 return port;
848 }
849 }
850 throw new Error("Unable to allocate adjacent free TCP ports.");
851}
852
853function freePort(): Promise<number> {
854 return new Promise((resolve, reject) => {

Callers 1

startIsolatedServiceFunction · 0.85

Calls 2

portAvailableFunction · 0.85
freePortFunction · 0.70

Tested by

no test coverage detected