Can P2P be done without port forwarding?
I was making a simple file transfer program through IRC and when I was reading up I saw that IRC when shar开发者_如何学JAVAing a file creates a direct connection between the two users independent of the server (DCC, Direct Client Connect). After searching a while I have found this: Direct Connect and Advanced Direct Connect.
None of these pages answer this question that I can't get out of my head: Is P2P data transfer possible without any user doing a special port-forward? An intermediate server which helps set up the connection (as in the IRC examples) is allowed. The data transfer itself must be independent of the server.
Yes - if you can get an external server to forward the connection request for you, there are so-called hole-punching techniques that can be used to set up a direct connection. This technical paper has a more detailed explanation.
Note that these do not necessarily work on all NATs - but they do work on quite a lot of them.
Practical JXTA II (available for reading on Scribd) has a chapter explaining techniques to perform NAT traversal. Hole punching is a subset of techniques to perform NAT traversal.
精彩评论