Search code examples
c#socketstcpnetwork-programmingvnc

How to forward packets via C# to another TCPClient running on another port


How can I forward packets using C# to another TCPClient running on another port.

I am new to Sockets programming in .Net. I am trying to make a VNC Repeater much like this perl script: http://snipt.org/wonG but I cannot keep my stream continuous.

An example of what I want to achieve is this:

Port 5500 listens, inspects the packet RemoteEndPoint and then and sends the packet back out on Port 5901.

Because the bulk of the traffic is considered 1 big open stream (it does not close or send chunks of data, it sends traffic for upwards of 10 minutes) how can I do this?

Does anyone have any suggestions or ideas on how to execute a TCPClient packet forwarding solution that supports large open streams(sessions)?


Solution

  • http://tcpsoftrouter.codeplex.com/ Is a good example.

    EDIT: Since this time I have written NRepeat. Available here https://github.com/jeremychild/NRepeat