Hello all,

I'm trying to validate the input for an IP address. I'm getting a little bit tied up on the logic of it...

The only thing I can really come up with is this:
-Take the IP address in as a char[]
-Parse to check for the correct format and number of decimal points
-Split it into four ints representing each octet
-check that the ints are within the valid range

I feel like there is a much better way to go about this...If anybody has done this before any help would be appreciated!


Of course, I could always compile a list of all IP addresses and compare an input string to each one...I flirted with this idea enough to make a quick program to output all IP addresses sequentially into a TXT file. I left it running for about 2 hours and had still only written less than 2% of all IP addresses!!