I'm assuming that port_number is of type char *.
The if statement you have there is comparing the address of the port_number C string with value of i, and I don't think that's what you want to do.
If you want to use ctype.h, then you can use the function "isdigit()" to check each element of port_number. Otherwise, the next best thing is to cycle through port_number, and figure out if each element is between ascii char '0' and '9', to make sure that the port number is entered correctly.