This is not something that you can do on the user side. This is an aspect
of a poorly coded application. As for preventing your computer from being
exploited by these, use a hardware or software firewall. And keep up to
date with Windows Update and the available security patches.