views:

99

answers:

4

Say, I have two computers behind firewalls, routers, etc (ie. no incoming connections). Is there ANY way I can connect the two through TCP/UDP protocol without everything going through a special server somewhere? I know Skype does something like that, perhaps not exactly.

Thanks.

+1  A: 

Though I've never used it myself, I believe this is what UPnP provides, assuming the firewalls and routers that are in the way play the game:

http://en.wikipedia.org/wiki/Universal_Plug_and_Play

See the section on NAT traversal.

Edit:

Wikipedia has a whole page on NAT Traversal:

http://en.wikipedia.org/wiki/NAT_traversal
Daniel Paull
+1  A: 

You will have to use P2P

jmservera
+3  A: 

This heise-article explains how Skype uses UDP hole punching to get 2 NAT-firewalled instances connected to each other.

Nevertheless, you need an external server for the initial connection-info-exchange, but you do not have to route a lot more than that through that special server.

Kosi2801
+1  A: 

Yes, this is often called 'hairpin network address translation', and is usually implemented on the device doing the address translation. This is not exactly the same thing as NAT traversal or hole punching as some other comments implied. You are trying to get two hosts behind the same NAT to communicate with each other.

I would take a look at the link below to see the various NAT implementation and decide which option will work for you. Here is a diagram and link for you:

http://www.cisco.com/web/about/ac123/ac147/images/ipj/ipj_7-3/anatomy_figure_10.gif

http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_7-3/anatomy.html

If you need this to be implemented on the client software, you may want to look into something like avahi or another 'zeroconf' option for discovering local installations.

http://en.wikipedia.org/wiki/Avahi_(software)

XL