2

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?

Witek
  • 6,160
  • 7
  • 43
  • 63

1 Answers1

1

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.

Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
  • thanks for the clarification @JVerstry, I thought JXTA could do the direct connection. Instead it couldn't. So what are the alternatives? Let's say if 2 devices are turning on their WIfi but they want to communicate each other without even connected to any network? – gumuruh Jul 06 '14 at 03:02