I have an dialog for HTTP proxy configuration with hostname and port edit boxes.
My question is how can I validate user input for correct hostname and port?
May be I have to use some regular expression for hostname validation or there is some helpful MFC or WinAPI function? What is the maximum correct number for port?
You can use Apache Commons Validator's InetAddressValidator. Check out http://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/InetAddressValidator.html.
That project has many validator utilities you can reuse. Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With