コード例 #1
0
ファイル: PortPool.cs プロジェクト: Silv3rcircl3/Mongo2Go
        /// <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;
            }
        }
コード例 #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);
            }
        }
コード例 #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);
        }