Ejemplo n.º 1
0
        /// <summary>
        /// Returns and reserves a new port
        /// </summary>
        public int GetNextOpenPort()
        {
            lock (_lock)
            {
                PortWatcher portWatcher = new PortWatcher();
                int newAvailablePort = portWatcher.FindOpenPort(_startPort);

                _startPort = newAvailablePort + 1;
                return newAvailablePort;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns and reserves a new port
        /// </summary>
        public int GetNextOpenPort()
        {
            lock (_lock)
            {
                PortWatcher portWatcher      = new PortWatcher();
                int         newAvailablePort = portWatcher.FindOpenPort(_startPort);

                _startPort = newAvailablePort + 1;
                return(newAvailablePort);
            }
        }
Ejemplo n.º 3
0
        public static IPortWatcher CreatePortWatcher()
        {
            IPortWatcher portwatcher = null;

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Unix:
                portwatcher = new UnixPortWatcher();
                break;

            default:
                portwatcher = new PortWatcher();
                break;
            }

            return(portwatcher);
        }