Hi all,
i've made a little googleing around the internet in order to find a nice and efficient way for a p2p(direct) connections between routers. I've discovered (a little late though) that it is possible to make a direct connection between devices behind routers through a technique called 'hole punching'. It's a simple principle and there are published papers on this research available on the internet. One that i find interesting and easy to understand is this:
http://www.brynosaurus.com/pub/net/p2pnat/.
Technique that i implemented and posted above is described as 'Relaying' which would be the case where we have a 'Relay' server on a well known address listening to user connections on a well known port. Users connect to server and then, on users demand, those connections 'bridge'(simple create two threads on 'Relay server' and forward everything from one user to another and vice versa). This handles the job surprisingly well on let's say 5 transactions at the same time that i tested(which servers its purpose). Really bad thing is that it consumes your server connection and slows it down by eating ram memory, etc..
This would be starting of a 'Relay' server on a public server machine, port 65123 :
java -jar pzAppServer.jar 65123
This is local server and client app in the same package, used to make connection to 'Relay' server, and then wrap application that needs to communicate with other application through 'Relay' server. In this case its winvnc.exe but it could as well be any windows or linux application:
java -jar pzAppWrapper.jar.
Another approach is using 'hole punching' technique which does not consume the server as in mean that the data transfer does not go through server. It uses server, here described as 'Rendezvous' server only to 'meet up' and exchange information on other party's address. What basically happens is that when i want to connect to other machine, I look up for its address on the 'Rendezvous' server and try to connect to it directly. At the same time, server tells the other party to try to connect to me, giving it my address and a port on my machine. This way both routers 'punch hole' on both routers which are now both expecting data from one to other. As this seems like no way in the hell it would work, the research that i provided above and couple others show that its pretty possible, and proven to work. They even marked the tested and 'well behaved' routers for this kind of job, as well as the percentage of tested routers that would work with this method.
I described the 'hole punching' method pretty roughly but you can get the idea of how things should work.
Now I searched for the implementation on this method and this showed up:
http://nutss.gforge.cis.cornell.edu/stunt.php. I found out that they proved the method to be working, and provided java classes with the implementation and then stopped developing it couple of years ago.
I can't find any library online with this technique implemented so i was wondering if any of you tried this or have any thoughts on this. The protocol called 'STUN' .
The final thought would be to take an reliable UDP library, STUN implementation, open SSL and VNCLibraries(libvnc(
http://libvncserver.sourceforge.net/)) and to make secure, efficient, fast, os independent, opensource, free, p2p remote desktop application.
Any thoughts? Ideas? Suggestions?
Sincerely,
Lazar