Skip to content
Docs Try Aspire

PortAllocator Methods

Class Methods 2 members
Allocates and manages a range of ports for use in an application context.
Marks a port as used to prevent it from being allocated.
public sealed class PortAllocator
{
public void AddUsedPort(
int port)
{
// ...
}
}
port int The port number to mark as used.
Allocates a port that is not currently in use.
public sealed class PortAllocator
{
public int AllocatePort()
{
// ...
}
}
int An available port number.