Convert VBScript to VB.NET

dedogs

New member
Joined
Mar 11, 2005
Messages
1
Programming Experience
Beginner
Hello lovely people,

I'm trying to use code that sets up port forwarding to a upnp router in a network so i can forward 3 ports. I'm doing this for a game freeley because people cannot host.

I have a VBScript code that can open the ports and talks just fine, but can i implement this into VB.NET?

If not can i call the script and get status information from it?

If not on that front can i write code in VB.NET that would talk to the UPNP router or atleast tell windows to open ports thats all i want.

VB.NET:
'This program enables an IRC file transfer port

'And then puts up a prompt waiting for the user

'to be finished transferring files

Set theNatter = CreateObject( "HNetCfg.NATUPnP")

Dim mappingPorts

Set mappingPorts = theNatter.StaticPortMappingCollection

'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 18010, "TCP", 18010, "192.168.1.101", TRUE, "Worms"

'

MsgBox("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 18010, "TCP"

MsgBox("We're done and the total number of ports is " & mappingPorts.Count)

Secondly, thankyou for donating your spare time to help beginners out :D
c ya
 
Back
Top