Refactored TCP port preference.