|
How to write proxy?
» I want to write program that redirects client to server and server to client |
|
02-13-2010, 07:54 AM
(This post was last modified: 02-13-2010 07:55 AM by rain-13.)
Post: #1
|
|||
|
|||
|
How to write proxy?
Hello.
I want to write program that listens tcp packets sent by program and then redirects them to server and when server answers I want to forward these answers to my program. I have program which allows me specify the server so I can change it's original server's IP to 127.0.0.1 which makes it send all the packets to local computer, now I just need to write program that accepts packets that came from 127.0.0.1:1234 and send them to 1.2.3.4:1234 and when server answers , send that answer to program that originally created these packets. I have only seen some proxies, but I have no idea where to start. Can someone help me please or give some links? |
|||
|
02-13-2010, 04:29 PM
Post: #2
|
|||
|
|||
|
RE: How to write proxy?
Read the TCP Windows Socket tutorials on the main page of infernodevelopment.com in the C++ category.
You create a server to accept an incoming request for proxy from some port that you will use to surf with that computer. Then your server waits for a request, such as a URL to fetch and proxy. So the server downloads the file and sends it back to you. There you go, a proxy... Think of a proxy as a representative, and the internet as congress, and you elect this representative to go to congress for you and bring you the information you need. ![]() ☤ ☢ Software Engineer - Director of Inferno ☢ ☤ |
|||
|
02-13-2010, 04:37 PM
(This post was last modified: 02-18-2010 11:30 AM by rain-13.)
Post: #3
|
|||
|
|||
|
RE: How to write proxy?
thanks for tip.
Quote:So the server downloads the file and sends it back to you. Well I am actually tring tocreate proxy for game in order to create/block/change packets that go from game to server or from server to client. Idea is that if i can check packets before forwarding them, I could block things like phissing chatmessages, earthquakes butcould also autoanswer and so on. In other words I need proxy that works with TCP packets (forward(client to server or server to client/block/modify/create/dump). |
|||
|
02-27-2010, 07:18 PM
Post: #4
|
|||
|
|||
|
RE: How to write proxy?
That might be a bit harder to program, but the idea is still the same. You wait for packets on a port from some client. Then you copy the packet and send it to the target server, get the response, then send the packet back to the client (client being user of proxy).
![]() ☤ ☢ Software Engineer - Director of Inferno ☢ ☤ |
|||
|
02-28-2010, 02:23 PM
Post: #5
|
|||
|
|||
|
RE: How to write proxy?
is there any functions like tcpsend()? or i have to make these functions myself reading the TCP Windows Socket tutorials on the main page of infernodevelopment.com?
Can it be single threaded or i need multithreading? Also login and chat is on one IP:port1 but soon as i create/join game I get random IP:port2. I have read trough Guests cannot see links in the messages. Please register to forum by clicking here to see links. Guests cannot see links in the messages. Please register to forum by clicking here to see links. but I didn't get much help With game i need to listen 127.0.0.1 and send packets 1.2.3.4 ? then how do i get server's response? just listen 192.168.1.100 and then forward to 127.0.0.1?? Actually I dont know how to listen server's response. |
|||
|
« Next Oldest | Next Newest »
|






![[Image: adminexecuterh8.png]](http://img159.imageshack.us/img159/526/adminexecuterh8.png)
