• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

AutoIT (Upnp) Add Port & Remove

Status
Not open for further replies.

rayane888

LvL-23
User
Joined
Dec 5, 2011
Messages
131
Reputation
0
Reaction score
735
Points
93
Credits
0
‎13 Years of Service‎
44%
Code:
>
$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
;Enabling the forward, and giving a name of the forward to be 'IRC'

$mappingPorts.Add (888, "TCP", 888, "192.168.30.15", True, "IRC")

MsgBox(0, "Ports added", "Suceessfull")

;To uniquely specify a forward, you give the external port
;and the protocol - here we remove the forward that we added

$mappingPorts.Remove (888, "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
 
Status
Not open for further replies.
Back
Top