Friday, August 25, 2006

Use CSharp and UPnP to open a Firewall port

While developing some of the P2P file transfer functionality for Filejack, I needed a way to allow inbound traffic to the client software without requiring the user to know how to configure their firewall, and the Universal Plug and Play (UPnP) protocol is one great way to accomplish this.

Nearly all firewalls support UPnP, which permits configuration of port forwarding policies by sending special SOAP packets to the firewall IP on the trusted side. I googled but never could find any simple code solutions which didn't require an external dll, but eventually I did gather enough info to create a simple CSharp class that does exactly what I need - open an external port and forward that traffic to an open port on an internal computer.

The class has one static method, so from your code all you have to do is call this:

OpenFirewallPort(int externalPort, int internalPort);


..Where externalPort is the Firewall port you want opened, and internalPort is the port on the computer you want it forwarded to (the computer which called the method).

The code sends the "open port" requests to each gateway IP configured on the calling computer, which works because the gateway is almost always the same IP as the Firewall.

If you want more control, just use the static overload of the same method where you can specify the gateway and the computer you want traffic forwarded to:

OpenFirewallPort(string machineIP, string firewallIP, int externalPort, int internalPort);


It's that easy! Download the source code here: UPnP.zip

Let me know how this works for you.

Tuesday, August 22, 2006

GIDE - The GooeyScript IDE

A couple of considerate guys from the UK, James and Ian, created an IDE for GooeyScript to make building your scripts with GooeyScript even easier. You can download GIDE here.

GooeyScript

Looking for GooeyScript?

GooeyScript is an ActiveX component I developed a few years ago which enables you create Visual Basic windows applications entirely from VBScript. It is useful for network administrators who need to interact with users during login scripts (almost always vbscript), or just as a convenient way to create a simple application with no compiling or other software necessary.

It's not being developed or supported anymore, but will will remain available for download here. The zip file includes documentation, a good demonstration script, and the full source code to the component. Free for anyone to use for anything - commercial, whatever.

Monday, August 21, 2006

Welcome

Hey folks. This is where I'll be posting bits of code and anything I happen to be working on dealing with Dotnet, Flash, JavaScript or whatever.

My current project is Filejack, and will eventually be available to the public at www.filejack.com. More to come about that later.