UDP,NAT和建立与QUOT;连接" [英] UDP, NAT and setting up "connections"

查看:193
本文介绍了UDP,NAT和建立与QUOT;连接"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个词在谈及UDP连接是不是真的合适,但是...

I know the word "connection" isn't really appropriate when talking about UDP, but...

如何做一个服务器(一个与已知IP)通过互联网获取其UDP数据包的客户端是在NAT后面?

How does a server (the one with the known IP) get its UDP packets through the Internet to a client that is behind NAT?

例如:如客户端连接,并使用一些消息通过TCP进行身份验证服务器。此时,服务器已准备好开始数据传输到客户端通过UDP,但如何在服务器知道从哪里解决的UDP数据包,使他们找到自己的方式,通过任何NAT路由器的客户端?

For example: say a client connects and authenticates to the server using some messaging over TCP. At this point the server is ready to start streaming data to the client over UDP, but how does the server know where to address the UDP packets so that they would find their way through any NAT routers to the client?

如果客户端拳头发送我已经准备好了流媒体,请消息在UDP上,将在NAT路由器保持端口开放,使服务器可与UDP数据的流应对?

If the client fist sends an "I'm ready for the streaming please" message over UDP, would the NAT routers keep the port open so that the server can respond with its stream of UDP data?

还是我WAAY偏离轨道在这里?

Or am I waay off track here?

推荐答案

通常,在客户端在TCP层的前地址转换将能够确定在UDP的连接是建立。话虽如此,在客户端地址转换将要被配置为接受从SRC服务器端口UDP数据包,然后将它们转发到内部目标IP(客户端)。重要的是要记住,如果NAT是讲师是谁,谁是被叫方。 NAT的不同的实施及能力这样一个通用的容易实现的解决方案可能是你可能要实施,根据您的需要。

Generally the NAT in front of the client at the TCP level will be able to determine that the connection at the UDP was create. Having said that, the NAT on the client side will have to be configured to accept UDP packets from the SRC server port, and then forward them to the internal destination IP (client). Important thing to remember if NAT is who is the caller and who is the callee. NATs differ in implementation and capablity so a generic easy to implement solution is probably what you might want to implement, depending on your needs.

您是在假设正确,我想,在你的情况下,客户端将无法接收UDP流中的信息。你的情况,你的客户将需要发送的广域网IP到你的服务器发起的UDP连接。找到你的客户的广域网IP可能会非常棘手,但也有网站,将有助于你determing您的广域网IP通过在文本页面返回。

You are correct in assuming, i think, that in your case client will not be able to receive the UDP stream in information. In your case your client will have to send its WAN IP to your server to initiate the UDP connection. Finding your clients WAN IP can be tricky but there are websites that will aid your determing your WAN IP by returning it in a text page.

如果服务器打开一个套接字客户端已知的UDP端口那么TCP连接后创建的UDP连接,UPnP的可能是值得寻找到它可以让你自动设置您的端口转发您的NAT,这只是如果你的NAT支持UPnP的是DSL路由器的情况。

If the UDP connection is created after the TCP connection by the server opening a socket to the client to a known UDP port then, UPnP might be worth looking into it will allow you to automatically set up your port forwards on your NAT, that is only if your NAT supports UPnP as is the case of DSL routers.

一个工作一个全面的将是客户端打开TCP和UDP套接字服务器。由于NAT之后的客户端发起的连接TCP和UDP连接的状态将被添加到NAT的连接表

A work-a-round would be to client to open both TCP and UDP sockets to the server. Since the client behind the NAT initiated the connection the states of both TCP and UDP connections will be added to the NAT's connection table.

这篇关于UDP,NAT和建立与QUOT;连接"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆