I try to make a P2P Program and need help with getting through the NAT of the clients. I have read many questions here on stackoverflow, but i never got what the drawbacks and benefits of all the Methods to get through a NAT are. How many routers support which methods? Which methods are commonly used by the big companies? (BitTorrent, TeamViewer,...) What are the drawbacks/benefits of the three methods i listed and which else exists?
问问题
6043 次
1 回答
16
UPnP requires software support in your router. Even when routers have it, it's sometimes turned off due to security concerns.
STUN uses a simple public server to detect the presence of NAT and the real IP addresses. This is useful for other, higher-level protocols that do the useful work.
打孔是一种连接两台计算机的简单技术。它需要第三台公共计算机在 NAT 后面的两台计算机之间进行通信。您可以使用自定义协议运行您自己的服务器,我们可以使用 STUN 和现有的 STUN 服务器。(设置只需要几个数据包,其余的都是点对点的)。
当然,有些NAT防火墙与上述不兼容,因此您可能需要自定义协议。Bittorrent 这样做:他们使用不同的技术,具体取决于哪些客户端位于防火墙后面等等。
于 2014-01-05T22:29:22.183 回答