Checks for invalid ip and port.