title: Forwarding RDP in tcp tunnel
body: <p>I am creating a TCP tunnel application for RDP connections, On Server-side: Redirecting RDP connections to tunnel-server, Then sending those data to Client-side which <em>receives the data successfully</em>. But what happens after that? I don't know!</p>
  <p>I know it is easier if traffic was HTTP/HTTPS because you can parse the header to address and content then send back the result. You don't even need TCP or sockets but forwarding RDP is unclear for me.</p>
  <p>How can i <strong>forward those traffics from client-side</strong> then sending the results back to server and mstsc (windows default RDP client)? My problem is with the concept, Should i send those RDP data to client then from client machine to port 3389? And this app is considered some sort of <strong>Socks Proxy</strong> i guess.</p>
  <p>This is the structure of what i have done at the moment:</p>
  <p><a href="https://i.stack.imgur.com/5N6xM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5N6xM.png" alt="Structure of this application in an image" /></a></p>
  <p>Similar threads that aren't answer to my issue:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/1821220/rdp-through-tcp-proxy">RDP through TCP Proxy</a></li>
  <li><a href="https://stackoverflow.com/questions/226784/how-to-create-a-simple-proxy-in-c">How to create a simple proxy in C#?</a></li>
  <li><a href="https://stackoverflow.com/questions/2620853/c-sharp-proxy-using-sockets-how-should-i-do-this">C# Proxy using Sockets, how should I do this?</a></li>
  </ul>
  <p>P.S. The type of programming language doesn't matter for me (Currently working with c# and python but newer languages are OK too), I just want to learn how it works conceptually with a simple pseudo-code or sample, All kind of explanations or examples are appreciated.</p>