Project Description
TCP PortReRouter is a basic network service that proxies TCP sockets to/from an alternate IP and/or an alternate port. ALPHA RELEASE

SSL is not supported as SSL implements IP validation.

Despite the 2.0 version reference (this being due to a rewrite in C# from a mostly working VB6 implementation), this is not reliable nor stable software, it is experimental, working perfectly only in the most trivial of tests, and as such any assists in debugging and improvement are welcome.

To configure TCP Port ReRouter, you must edit the TcpPortReRouterService.exe.config file if running as a Windows service or the TcpPortReRouter.exe.config file if running the console application.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="portRerouter" type="TcpPortReRouter.RouteMapConfiguration, TcpPortReRouter"/>
  </configSections>

  <portRerouter>
    <routes>

      <!-- listen on the primary IP on port 89, redirect to www.google.com on port 80 -->
      <add name="www.google.com on port 89" listenPort="89" targetHost="www.google.com" targetPort="80"></add>

      <!-- listen on the loopack adapter, redirect to www.google.com's IP address on port 80 -->
      <add name="www.google.com on loopback @ port 89" listenIP="127.0.0.1" listenPort="89" targetHost="74.125.19.99" targetPort="80"></add>
      
    </routes>
  </portRerouter>
  
</configuration>

To run the console application just start TcpPortReRouter.exe.

To install the Windows service run installutil.exe from one of the framework runtimes in C:\Windows\Microsoft.NET\ with the path to TcpPortReRouterService.exe as the argument. The "/?" help output will describe how to use it. If you do not know which directory to invoke it from, I normally use this as my preference guide based on availability, based on whether I have an x64 OS or have .NET 4.0 installed, with most preferred first:
  1. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe (64-bit, .NET 4.0)
  2. C:\Windows\Microsoft.NET\Framework64\v2.0.50727\installutil.exe (64-bit, .NET 2.0; Note: the project is compiled for .NET 4.0, but can theoreticaly be recompiled to the 2.0 CLR runtime as .NET 3.5)
  3. C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe (32-bit, .NET 4.0)
  4. C:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil.exe (32-BIT, .NET 2.0; Note: the project is compiled for .NET 4.0, but can theoreticaly be recompiled to the 2.0 CLR runtime as .NET 3.5)

Another obvious note, only run installutil.exe once. Don't try to run it once for each of the runtimes listed. There is only one Windows services registry. ;)

Care to donate?

Buy me a coffee. Seriously, sitting at Starbucks with my laptop producing this is the way I spent my vacation.

About the author

Visit my web site: http://www.jondavis.net/

Last edited Aug 21, 2013 at 10:38 PM by stimpy77, version 21