refine local vs remote ports