NAT traversal with Java

偶尔善良 提交于 2019-12-08 23:34:26

问题


I want to connect to computers, each one of them behind a NAT router. I read that STUN only works with one computer behind a NAT router. Is that true? If so, how can I solve that double-NAT problem?

Thanks, Thomas


回答1:


UDP hole punching and TCP hole punching




回答2:


TURN is a set of extensions to STUN that help to solve the double-NAT problem. You still need a server in the cloud, and the clients need to register. Source for some free servers is available.

From the TURN internet draft:

As described in [RFC5128] and [RFC4787], hole punching techniques
will fail if both hosts are behind NATs that are not well-behaved. For example, if both hosts are behind NATs that have a mapping behavior of "address dependent mapping" or "address and port dependent mapping", then hole punching techniques generally fail.




回答3:


If you dó not have a central server, you May consider using upnp if available to create a hole in the router. Azureus/vuze does this.



来源:https://stackoverflow.com/questions/2116403/nat-traversal-with-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!