title: How to create a generic network proxy using Python or C++?
body: <p>I have an application which communicates over the local area network. However, I want to instead make it communicate over the internet. To do this I propose making an intermediate program which will read the network traffic generated from the application on one computer and send it to the application on another computer.</p>
  
  <p>This involves:</p>
  
  <ol>
  <li>Reading the outgoing network traffic of the application</li>
  <li>Sending a copy of this traffic over the internet to another computer</li>
  <li>Giving this copy to the application on the other computer</li>
  </ol>
  
  <p>Instead of this:</p>
  
  <p>Application on computer A &lt;-LAN-> Application on computer B</p>
  
  <p>I want to achieve this:</p>
  
  <p>Application on A &lt;--> My Program on A &lt;-INTERNET-> My program on B &lt;--> Application on B</p>
  
  <p>I can accomplish (2), but with (1) and (3) my problem is that I have very little experience with networking and I do not know where to start. I can program in python but would be willing to use c++ to accomplish this.</p>
  
  <p>(Hamachi does not work for this application, I do not know why.)</p>
  
  <h2>In response to comments</h2>
  
  <p>I do not intend to manipulate any data unless it is necessary to make the connection work. I have no control over the application itself and it does not provide me with any methods to configure the connection with the exception of a port number.</p>
  
  <p>TCP and UDP are both used on the port 6112. The IP addresses used are first 255.255.255.255 for a generic broadcast used to discover other applications on the LAN (with UDP), then a TCP connection is established.</p>