Function to read masked port numbers