BitSharp.IntegrationTest.PullTester.FindFreePort C# (CSharp) Method

FindFreePort() private method

private FindFreePort ( ) : int
return int
        private int FindFreePort()
        {
            var listener = new TcpListener(IPAddress.Loopback, 0);
            listener.Start();
            try
            {
                return ((IPEndPoint)listener.LocalEndpoint).Port;
            }
            finally
            {
                listener.Stop();
            }
        }
    }