Question

I'm working on a live video Java application, and have run into the common problem of NAT traversal - two computers can connect to each other on local network, but not when they're behind NATs. I've done some research and the easiest option to get my head round is the JSTUNT library from Cornell.

However, it seems to require you to use a URI to connect the computers together, and I'm really not sure how to do this - is there a way of discovering your own URI in Java?

Their STUNTServer class seems designed to do this, but as near as I can work out only returns socket.getSocketAddress() - which doesn't seem to be the same as a URI.

Any insight would be appreciated.

Was it helpful?

Solution

I tried to make this library work but unsuccessfully. I have been in contact with the author of this project and he told me it was only developed for testing and research purposes. He also told me that it was not production ready and would need some serious rework.

To answer your question:

is there a way of discovering your own URI in Java?

The issue is about discovering the public IP address mapped to your private IP address by your NAT. This is only visible from the WAN (i.e., outside of your LAN). The stunt server is indeed helping achieving this objective.

NAT traversal is a complex subject. You can find more information about it in the corresponding chapter of the Practical JXTA II book available online for reading at Scribd.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top