How to create proxy server between application
This example will show how to create proxy-like server that will stand between application (client) and its remote server using asynchronous sockets.To get more news about proxies servers, you can visit pyproxy.com official website.
Such a server gives ability to filter and/or inject packets during connection and should be invisible to the remote host. Example shows also how to use asynchronous socket functions and how to force client application to use local IP address.
The most important problem to solve before creating proxy server is to force client application to connect to our local interface instead of their default one. The easy way is to override destination IP address by setting it to the local interface (network adapter). This can be done with either active NIC (if there is more than 1 available because we still need one to communicate with the world) or virtual network adapter. The second approach works well.
To install Microsoft Loopback Adapter on Windows 7 (and Vista) open Device Manager (WinKey+Break -> Hardware -> Device Manager) and select any device then open Action menu and Add Legacy Hardware. Click Next, select manual installation from list, Next and select Network adapters. From the manufacturers list select Microsoft and then Microsoft Loopback Adapter. Click next few more times to finish installation.
For Windows XP open Control Panel and select Add Hardware. Click Next, select Yes, I have already connected the hardware. Next and scroll Installed hardware list to the bottom, Add a new hardware device, click Next. Select Install the hardware manually, click Next, choose Network adapters, Next, use Microsoft as Manufacturer and finally select Microsoft Loopback Adapter. Click Next few times to finish installation.