PDA

View Full Version : tunneling in Qt



socek
4th May 2007, 20:48
I want to make something like that: I will run server for WWW on port 80. I want my program in QT to "catch" port 80, and trasport everything from/to port 80 to/from port 2000. is this possible in Qt4?
I don't know if I described this well.

wysota
4th May 2007, 21:17
It's possible, but all packets will have ip of the "proxy" (your Qt application).

socek
4th May 2007, 21:24
Ok. I may live with that. So, how can I make this?

croftj
4th May 2007, 21:42
I'm a firm believer that Qt is up to darned near any task. With that said I also think the right tool for the right job. Check out the program proxy @

http://sourceforge.net/projects/proxy/

If you are still interested in using Qt, here's a hint on where what would have to be done.

Stat with a QCoreApplication, have it create a QTcpServer, set this up to listen on port 80.

When a connection comes in, create a QTcpSocket and have it connect to the port you want to move the traffic too.

Then just connect signals and slots so the traffic get funneled between the two.

My explaination is very simplistic and may be full of holes that you would have to fill in, things like subclassing the socket objects to make the traffic flow, maybe making it threaded. Possibly other things too. If I got any more detailed than I did, I would write it, and you probably don't want that.

-joe