I recently had the opportunity to work on a dental clinic application which was developed by some private business in Mexico. Unfortunately, they had absolutely no technical documentation or manual. The person who installed it left the client's firewall off because they couldn't figure out what ports were being used by the software itself, thus leaving open vulnerabilities.
So as a quick tip we can always find out the ports being used by the software as follows, first run the following command:
-a Displays all connections and listening ports.
-b Displays the executable involved in creating each connection or listening port. In some cases well-known executables host multiple independent components, and in these cases the sequence of components involved in creating the connection or listening port is displayed. In this case the executable name is in  at the bottom, on top is the component it called, and so forth until TCP/IP was reached. Note that this option can be time-consuming and will fail unless you have sufficient permissions.
A simple command like this shows you the ports which are being used for communication. Once, you have that figured out you can go to your firewall and create the necessary rules.
published by Alberto J. Matus