add validation for port values to server (fix #3227)

65535 is the max.