Some questions in response to your question:
- Is the computer on the other end under your "control" (on the same LAN/WAN/VPN, accessible by you under some agreement with whatever remote network the computer is hooked into)?
- Are you scanning "intelligently" (trying the ports most likely to be the ones used first)?
- Could there be multiple copies of the same or similar software running on different ports?
If the answers are "yes", "yes", and "no", respectively, then a port scan is probably permissible. If you don't know exactly which port you must connect on (and it's not the default for the application or higher-tier protocol being used), then the only two options are to ask some authority (human or automated) or to try all possibilities.
Things that are always bad about port scanning are:
- Port scans are a common attack precursor; the attacker is looking for an open door to establish a connection for further exploits. Thus, sysadmins and the hardware they maintain will see your scan, assume it's hostile and take steps to shut you down.
- If port scans are to be expected as normal, the effectiveness of many anti-hacking tools is greatly reduced. As in the previous point, port scans are a common precursor to an attack. If some scans are to be expected as normal, and others shut down as hacking, the sysadmin/firewall must know exactly which is which (and whenever there's a legitimate way to get in, there's a way to spoof it).
- Port scans take time. If the remote computer ignores rather than rejects connection requests, each attempt must time out (taking several seconds) instead of your scan being able to move on to the next port after a rejection (bound mainly by threading and network latency).
However, targeted port scans on computers under your control can be a useful diagnostic. I implemented a port scanner into some software my company's help desk uses, as a diagnostic to determine why a machine they support is responding to pings but not allowing more advanced access.