public static void Main(string[] args) { var ipAddress = "10.208.162.96"; var ipAddress2 = "10.208.162.110"; var port_in = 3003; var port_out = 3003; var tcpForwarder = new TcpForwarderSlim(true, new ClientToServerDataAnalyzer()); tcpForwarder.Start( new IPEndPoint(IPAddress.Parse(ipAddress), port_in), new IPEndPoint(IPAddress.Parse(ipAddress2), port_out)); }
public void Start(IPEndPoint local, IPEndPoint remote) { _mainSocket.Bind(local); _mainSocket.Listen(100000); while (true) { var source = _mainSocket.Accept(); var destination = new TcpForwarderSlim(!this._isClientToServer, new ServerToClientDataAnalyzer()); var state = new State(source, destination._mainSocket); destination.Connect(remote, source); source.BeginReceive(state.Buffer, 0, state.Buffer.Length, 0, OnDataReceive, state); } }