CreatePortWatcher() public static method

public static CreatePortWatcher ( ) : IPortWatcher
return IPortWatcher
Exemplo n.º 1
0
        /// <summary>
        /// Returns and reserves a new port
        /// </summary>
        public int GetNextOpenPort()
        {
            lock (_lock)
            {
                IPortWatcher portWatcher      = PortWatcherFactory.CreatePortWatcher();
                int          newAvailablePort = portWatcher.FindOpenPort(_startPort);

                _startPort = newAvailablePort + 1;
                return(newAvailablePort);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns and reserves a new port
        /// </summary>
        public int GetNextOpenPort()
        {
            IPortWatcher portWatcher = PortWatcherFactory.CreatePortWatcher();

            return(portWatcher.FindOpenPort());
        }