Extracted port number resolution to a method