How to add an exception in port forwarding?

Started by
3 comments, last by Erik Rufelt 12 years, 6 months ago
The multiplayer of my game for some computers works fine, however others are unable to connect with other players since some routers are blocking game packets. I know I need to add an exception in the port forwarding table of the router. What I don't know is how to do it.
I tried putting netsh add allowedprogram {app}\game.exe AppName ENABLE in the installation file of Inno 5.3.1, but it gave me an error.
Advertisement
What error did it give you? Does the installer run with the privileges necessary for that command?

I don't see how that command is going to help you if the problem is a router along the way. Do you know where the packets are being dropped? What steps do you have to take manually to get the packets to work?

What protocol are you using? Is your code designed to traverse NAT?
the error was
directive "netsh add allowedprogram {app}\game.exe AppName ENABLE" has no value[/quote]
I'm trying to add an exception in the port forwarding table using code. The protocol I use is TCP.

the error was
directive "netsh add allowedprogram {app}\game.exe AppName ENABLE" has no value

I'm trying to add an exception in the port forwarding table using code. The protocol I use is TCP.
[/quote]

Are you sure the problem is the local machine, and not the router/firewall/cable/DSL modem ?

If you want to administer the firewall on a Windows machine from code (such as in your installer), you need:

1) To have administrative privilege elevation (typically set ALLUSERS=1 in your .msi file)
2) Use the INetFwMgr interface LocalPolicy property to change settings: http://msdn.microsoft.com/en-us/library/aa365287(v=VS.85).aspx
Here's another link: http://msdn.microsoft.com/en-us/library/aa366421(v=VS.85).aspx
enum Bool { True, False, FileNotFound };
Parameters should probably be "firewall add allowedprogram" not just "add allowedprogram", and try using ENABLE ALL instead of just ENABLE. If you Google for Innosetup firewall exception there are many examples.

(And as others have already pointed out the Windows firewall has nothing to do with the router).

This topic is closed to new replies.

Advertisement