/// <summary>
        /// Returns and reserves a new port
        /// </summary>
        public int GetNextOpenPort()
        {
            lock (_lock)
            {
                IPortWatcher portWatcher      = PortWatcherFactory.CreatePortWatcher();
                int          newAvailablePort = portWatcher.FindOpenPort(_startPort);

                return(newAvailablePort);
            }
        }
Exemple #2
0
        /// <summary>
        /// Returns and reserves a new port
        /// </summary>
        public int GetNextOpenPort()
        {
            IPortWatcher portWatcher = PortWatcherFactory.CreatePortWatcher();

            return(portWatcher.FindOpenPort());
        }