title: What protocol to use for P2P file transfer for two hosts behind NAT?
body: <p>I am trying to build an application that does p2p file transfer between hosts using Java.
  It works fine for hosts that have public IPs, but failed when I test it on my home computer.</p>
  
  <p>Then I find that all computers in my house have same IP. So, I conclude that my ISP uses NAT overloading. If my ISP does that, chances are lots of other ISPs do NAT too. I want my application also works even behind NAT. </p>
  
  <p>I did some research and found that UDP may be more suitable in this case because UDP hole punching works much better than TCP hole punching. Is it true? To be honest, I prefer to use TCP, but if UDP works better then I have to use UDP. (I know UDP is not reliable. I need to build some rdt protocol on top of UDP.) Or are there any other good algorithms that I missed?</p>