开发者

Java Stunt and URI discovery

开发者 https://www.devze.com 2023-02-18 07:01 出处:网络
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'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 socke开发者_如何学运维t.getSocketAddress() - which doesn't seem to be the same as a URI.

Any insight would be appreciated.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消