Jump to content

port foward


Recommended Posts

YEs its very possible, but it will probably all be done "Visually" not behind the scenes ( I.E. program opens a browser window and manually inserts the information into the port forwarding part of your router )... It could very well be done by sending POST / GET information, but im not familiar with that :whistle:

Link to comment
Share on other sites

Found this leftover code in my script test folder, but it is unfinished as I wanted to check if the background uPnP service was running first and do some more checking before invoking the commands and afterwards to see that they actually worked, but if you can make use of it then any code would be appreciated as I have concentrated on other things in the meantime...

;uPnPadd.inc
;This adds the specified ports to the router port forwarding tables using uPnP
;See [url="http://www.knoxscape.com/Upnp/NAT.htm"]http://www.knoxscape.com/Upnp/NAT.htm[/url]
; http://forums.practicallynetworked.com/showthread.php?t=5324
; http://www.vbdotnetforums.com/showthread.php?t=2175
; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ics/ics/istaticportmapping.asp

;This program enables an IRC file transfer port
;And then puts up a prompt waiting for the user
;to be finished transferring files

$theNatter = ObjCreate( "HNetCfg.NATUPnP")
Dim $mappingPorts
$mappingPorts = $theNatter.StaticPortMappingCollection

If IsObj($mappingPorts) Then
 
 ;We add a new port saying that externally accept from port 1024
 ;route to internal port 1024 on computer with IP 192.168.1.101
 ;Enabling the forward, and giving a name of the forward to be 'IRC'
 
 $mappingPorts.Add (1024, "TCP", 1024, "192.168.1.101", True, "IRC")
 MsgBox(0, "Ports added", "Total number of ports after add is " & $mappingPorts.Count & ". Hit OK when you're done transfering")
 
 ;To uniquely specify a forward, you give the external port
 ;and the protocol - here we remove the forward that we added
 
 $mappingPorts.Remove (1024, "TCP")
 MsgBox(0, "Ports removed", "We're done and the total number of ports is " & $mappingPorts.Count)
 
Else
 
 MsgBox(0, "Problem","Could not create a uPnP object")
 
EndIf
You should find that most modern routers support uPnP unless it has specifically been turned off in the configuration (mainly for security reasons).
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...