refactored Component::getNearestPort