Connecting two computers behind routers over the internet
Connecting two computers behind routers over the internet
(OP)
Hello,
I'm working on a code that connects two computers together to transfer files between them, right now if one computer is behind a router I make it the client and the other computer becomes the server, however if both computers are behind routers I can't seem to do anything about it.
I do understand I can do port-forwarding to solve this problem, but I'm trying to do it without having the user do any extra configuration, I have a server in the middle between the two computers where they have to authenticate before I establish a direct link between them, I can use that to get extra info about the two computers.
So the question is as follows:
Is it possible to have a direct connection between two computers if both computers are behind routers? considering I can get all kinds of information about those computers from the server (i.e the lan-address of each)?
There's a software called TeamViewer that does this, how does it work?
I'm working on a code that connects two computers together to transfer files between them, right now if one computer is behind a router I make it the client and the other computer becomes the server, however if both computers are behind routers I can't seem to do anything about it.
I do understand I can do port-forwarding to solve this problem, but I'm trying to do it without having the user do any extra configuration, I have a server in the middle between the two computers where they have to authenticate before I establish a direct link between them, I can use that to get extra info about the two computers.
So the question is as follows:
Is it possible to have a direct connection between two computers if both computers are behind routers? considering I can get all kinds of information about those computers from the server (i.e the lan-address of each)?
There's a software called TeamViewer that does this, how does it work?
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
So basically each computer is behind a different router.
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
My question is there anyway to establish the connection without any extra configuration?
There's a software called TeamViewer that does that, do you know how it works?
RE: Connecting two computers behind routers over the internet
If you have a server in th middle, perhaps you could either create a virtual bridge port that could join the two networks or use do some IP forwarding (often times referred to as IP Masquerade). I don´t know a whole lot about HOW to do that, so I can´t offer implementation details but it is something to look into.
RE: Connecting two computers behind routers over the internet
If anyone has any other ideas or suggestions I'd appreciate it.
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
/
tim@tim-laptop ~ $ sudo apt-get install windows
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package windows...Thank Goodness!
RE: Connecting two computers behind routers over the internet
1. If either router supports UPnP (basically a way to tell the router to forward ports from my application) I'd forward the port I need from my application and use it as a server.
2. If not, there's a nice method called TCP hole punching discussed here:
http://tools.ietf.org/html/rfc5128
Neither way is guaranteed to work, but it's a good starting point.
RE: Connecting two computers behind routers over the internet
RE: Connecting two computers behind routers over the internet
I am trying to do a similar software which allows the serial port to be accessed from anywhere.
Just wanted to know how you are progressing. your findings may help me too.
Thanks
RE: Connecting two computers behind routers over the internet
I ended up implementing UDP Hole punching technique, it has a high success rate and it's easy to implement.
The basic concept is that both computers A and B must send a UDP packets to each other at the same time, you'll need a rendezvous server to sync between the two computers before any communication can be made.
Read here in details:
http://www.brynosaurus.com/pub/net/p2pnat/
Section 3, UDP Hole Punching
If you have any questions I'm ready