Sorry but can you explain further
man ipfw tells you everything you need to know (and more) about setting ipfw rules.
What goes in place of the 'any to any'? anything or is that it?
The syntax of an ipfw
allow rule is:
allow [protocol] from [souce] to [dest] [port]
So the statement:
allow tcp from any to any 16004
says that
any source address is allowed to connect to
any destination address on port 16004. To be more secure you might lock down the port so that specific IP addresses can connect, e.g.:
allow tcp from 192.168.1.0/24 to in 16004
this says that any machine on the 192.168.1.0/24 network is allowed to connect to any interface on the current machine ('in') on port 16004