Click here to Skip to main content
15,435,745 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am pretty new to this Networking stuff in .net.

I need to establish a TCP channel between 2 machines and their ports.
Machine A is vncclient, Machine B acts as Routing Server, Machine C is vncserver.

1.Machine A Sends the requests to MachineB 5900 port
2.Need to establish a channel which gets the data from MachineB 5900 and fwd the data to Machine C 5900 and viceversa.
3.This program needs to be run on Machine C Server.

private void Connectandtransfer(IPAddress1, port1,IpAddress2, port2)
//need to extablish a bidirectional channel. 

In this case how can i avoid the self looping of data?

I am confused on how to achieve this as Sockets,TCpChannel, Remoting, TCP Hole punching, Port forwarding look much similar.. But none of them satisfied my requirement.

Please guide me on how to achieve this.
Updated 8-Jul-16 23:49pm

1 solution

Using VB6 or C# Language, I think you should try to Execute netsh Command Using
Shell( ) to port forward, see the commands below:
' --------------------------------------------------
' To Port Forwar Use:

netsh interface portproxy add v4tov4 listenport=3000
listenaddress=l.l.l.l connectport=4000 connectaddress=

' To Remove Port Use:

netsh interface portproxy delete v4tov4 listenport=3000

Hope you Can Do it.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900