javanetwork-programmingp2pjxta

Does JXTA support direct P2P communication, even if both peers are behind NATs?


With two JXTA based peers, each one behind its own NAT, is it possible for them to send direct messages to each other?

It is ok to use a rendezvous server for initial connection, but the real message with the payload needs to be sent directly from one peer to the other without a "gateway" on the internet.

I think Skype does that. I have heard about a trick using UDP instead of TCP. But does JXTA support that? Is it even possible with Java?


Solution

  • If both peers have a public IP address, then yes, it is possible. But since this is very rare, those peers will need a relay most of the time.

    JXTA does not support direct connection between NAT-ed peers if they have private addresses.

    It is possible to achieve this with Java when NATs are traversable, but it requires a sophisticated solution for TCP. For UDP, it is simpler.