or run

npx @tessl/cli init
Log in

Version

Files

docs

index.mdport-configuration.mdport-finding.mdsocket-finding.md
tile.json

task.mdevals/scenario-7/

Sequential Port Allocator

A small utility that discovers multiple free TCP ports in order, suitable for booting clusters of local services without collisions.

Capabilities

Allocate sequential ports

  • Requesting 3 ports with a start of 3000 returns exactly three consecutive, ascending free TCP ports beginning at or above 3000 on the default host set. @test

Stop boundary enforced

  • Requesting 2 ports between 65534 and 65535 results in a rejection that states no sufficient ports are available within the requested bounds. @test

Custom host support

  • Providing host "127.0.0.1" returns sequential free ports bound for that host, and providing an invalid host string results in a rejection before scanning. @test

Implementation

@generates

API

export type PortRequestOptions = {
  startPort?: number;
  stopPort?: number;
  host?: string | null;
};

export async function findSequentialPorts(
  count: number,
  options?: PortRequestOptions
): Promise<number[]>;

Dependencies { .dependencies }

portfinder { .dependency }

Locates available TCP ports across hosts to satisfy sequential allocation requests.