You mentioned using Windows as an OS. It has an in-built firewall in which you can set rules for connections (specific ports or range, incoming/outgoing, specific programs, etc). All firewalls basically behave like this, it's more about how 'aggressive' you want it to be.
There are better/more...