Unable to fetch a port number

When we fetch some port numbers, we could fetch only one port number because the port number was overriden. So we added another port valiables (r_port).