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.
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.
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?