Force connection through proxy
i'm trying to write a program, that will force a selected program to connect through a local proxy, that proxy will be my program listening, and then i will be able to monitor the packets this program is sending and receiving, and still send the packets to the original client/server, i.e. : act as a proxy.
i already wrote a code to listen, and when a connection is made to monitor the packets and send them forward to the real server(i already have the address of the server i want to contact), and a code to accept packets from this server and send them back to the client, but i'm having trouble forcing the external program to connect through the localhost(my listening proxy).
i thought about hooking, but if i'm gonna hook anything than what? and how?
thanks in advance.