[SOLVED] Is 172.32.254 a valid ip address ? TryParse thinks it is.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I don't know anything about C# or TryParse(), but: that seems like an absurdly blatant validation failure. Not only that, it's inserting a value for you. (Maybe the documentation speaks to what happens when you pass it three octets?)
IPAddress.TryParse uses inet_addr under the hood to parse an IPv4 address. This makes the following rules valid:
1) Each part of the address can be either specified in decimal, octal or hexadecimal notation. A leading zero will indicate an octal number, a "0x" prefix will indicate an hexadecimal one. The following strings will all parse to the same address:
I found that link, but I never read the user comments in it (till somebody on another forum pointed me to it about 8 hours ago). In my opinion it should not be there but under remarks in the 'official' section.
And this is the inet_addr link that I found on msdn.