views:

505

answers:

1

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?

+1  A: 
  1. Port number is an unsigned short from 1-65535, ports under 1024 are reserved for system services http, ftp, etc.
  2. I don't believe that you can validate host name (or should) especially when you have locallized host names.
Shay Erlichmen
Privileged ports are those below 1024, not 256.
mseery