Add method for validating port numbers