# PortAllocator Constructors

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [PortAllocator](/reference/api/csharp/aspire.hosting/portallocator.md)
- Kind: `Constructors`
- Members: `1`

Allocates and manages a range of ports for use in an application context.

## PortAllocator(int)

- Name: `Constructor(int)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/PortAllocator.cs#L13-L16)

Allocates and manages a range of ports for use in an application context.

```csharp
public sealed class PortAllocator
{
    public PortAllocator(
        int startPort = 8000)
    {
        // ...
    }
}
```

## Parameters

- `startPort` (`int`) `optional`

## Remarks

This class starts allocating ports from a specified initial port (default is 8000) and ensures that allocated ports do not overlap with ports already marked as used.
