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

Function freePort

scripts/bench/agent-control-benchmark.mjs:1335–1344  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1333}
1334
1335function freePort() {
1336 return new Promise((resolve, reject) => {
1337 const server = net.createServer();
1338 server.on("error", reject);
1339 server.listen(0, "127.0.0.1", () => {
1340 const address = server.address();
1341 server.close(() => resolve(address.port));
1342 });
1343 });
1344}

Callers 1

startArgentToolServerFunction · 0.70

Calls 3

listenMethod · 0.80
addressMethod · 0.80
closeMethod · 0.65

Tested by

no test coverage detected