settings in rc.firewall

Hi everyone.

I'm trying to setup eMule and torrents on the local network behind the BSD server. And everything seems to work except one detail - it works as long as

${fwcmd} add deny log tcp from any to any in via ${oif} setup

is commented out. Meaning that not only required ports are open, but any other ports.
My question is how do I setup everything to pass only specific ports for torrent and eMule and block everything else?
I've tried writing similar rule, but allowing needed ports, but it doesn't work. For instance -

${fwcmd} add pass tcp from any to any in via ${oif} 4662 setup

.

Thanks in advance.

I believe there's a duplicate post by you. We will need to close this