Existing TCP Relay Solutions [closed]

Solution 1:

If your relay machine is running Linux or any UNIX-like OS, you can use socat (http://www.dest-unreach.org/socat/, it is included as a package in many Linux distributions). In its simplest form, you can start the relay with something like:

socat TCP4-LISTEN:12345 TCP4-LISTEN:54321

(where 12345 and 54321 are the ports on which the server listens for each connection). One of the clients connects one one port, the other on the other port, and then data is exchanged in both directions. If one machine sends data before the other connects, it is buffered and sent after the connection.

See also here: socat connect-connect "proxy" two inbound TCP connections to expose a firewalled service?.