Improve this Doc View Source

Class ListenerPortExtensions

int[] extensions, which in this case is an array of ports

Inheritance
System.Object
ListenerPortExtensions
Namespace:Dapplo.HttpExtensions.Listener
Assembly:Dapplo.HttpExtensions.dll
Syntax
public class ListenerPortExtensions

Methods

| Improve this Doc View Source

CreateLocalHostUri(Int32[])

Create an Localhost Uri for an unused port

Declaration
public static Uri CreateLocalHostUri(int[] possiblePorts)
Parameters
Type Name Description
System.Int32[] possiblePorts

An int array with ports, the routine will return the first free port.

Returns
Type Description
System.Uri

Uri

| Improve this Doc View Source

GetFreeListenerPort(Int32[])

Returns an unused port. A port of 0 in the list will have the following behaviour: https://msdn.microsoft.com/en-us/library/c6z86e63.aspx If you do not care which local port is used, you can specify 0 for the port number. In this case, the service provider will assign an available port number between 1024 and 5000.

Declaration
public static int GetFreeListenerPort(int[] possiblePorts)
Parameters
Type Name Description
System.Int32[] possiblePorts

An int array with ports, the routine will return the first free port.

Returns
Type Description
System.Int32

A free port