I am looking for a Windows 7 program that can give an alert if a remote computer tries to connect on a given port, and gives the option to accept or refuse. I don't want any warning regarding other ports. I am not sure which firewall allows that. Gratis is better. Ideally, it should remember the decisions, i.e., maintain a whitelist of IPs.
Most antivirus suites have a version that comes bundled with a firewall which supports this.
Example interaction dialog for ESET Smart Security firewall
There are some firewall-only products which also have some free versions (Comodo, ZoneAlarm, etc) but in my experience, the free versions are limited (sometimes unintentionally), provide less info, have a much worse user experience and, last but certainly not least, are known to get Windows in trouble when certain exotic conditions occur and all Windows network connectivity becomes broken.