Creating a direct connection behind NAT routers, no router modifcations
843790Aug 17 2008 — edited Aug 20 2008Im trying to write a app which will connect 2 computers which are behind Nat routers and whos users dont need to set up port forwarding on them.At the moment I am using a college ssh server to act as an intermediate.
Server listens to localhost:4444
Remote port forwarding is set up which forwards college:3333 to localhost:4444
Client connects to localhost:4444
Local port forwarding is set up which forwards localhost:4444 to college:3333
This works fine but I would like it if the connection wasn't maintained over college.
What I want to try and set up is a direct connection and only use college as a intermediate for the initial transfer of details.
I know this can be done as I have used UltraVNCs NAT-to-NAT.
http://www.uvnc.com/addons/nat2nat.html
How could this be achieved in java?
In my thinking if the server made a outgoing connection through the router and the router received a incoming connection with the correct packet header it would presume it was just a response to the initial outgoing connection and not a separate incoming connection and would forward it on correctly.As a connection is nothing more that just bytes being received and sent on a single wire "all" I need to do is sent the right configuration of bytes.....
Thanks Ger.