예제 #1
0
        public override int GetNextFreePort(string trace)
        {
            int port = _portRepository.reserveNextPort(trace);

            while (_portProbe.isOccupied(port))
            {
                port = _portRepository.reserveNextPort(trace);
            }

            return(port);
        }
예제 #2
0
        public override int GetNextFreePort(string ignored)
        {
            lock (this)
            {
                while (_currentPort <= EphemeralPortMaximum)
                {
                    if (!_portProbe.isOccupied(_currentPort))
                    {
                        return(_currentPort++);
                    }

                    _currentPort++;
                }

                throw new System.InvalidOperationException("There are no more ports available");
            }
        }