Click here to Skip to main content
12,397,480 members (62,050 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#2.0 C#3.0 C# C#4.0 TCP/IP
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.
Posted 4-Oct-12 15:56pm
Updated 8-Jul-16 23:49pm
v4

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Quote:
Using VB6 or C# Language, I think you should try to Execute netsh Command Using
Shell( ) to port forward, see the commands below:
' --------------------------------------------------
NATIVE WINDOWS PORT FORWARD ( * MUST BE ADMIN)
' To Port Forwar Use:

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

' To Remove Port Use:

netsh interface portproxy delete v4tov4 listenport=3000
listenaddress=l.l.l.l

Hope you Can Do it.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 9 Jul 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100