Adobe AIR、URLRequest 和本地端口

发布于 2024-10-19 09:10:27 字数 649 浏览 7 评论 0原文

我正在考虑使用 Adob​​e AIR 编写一个应用程序,但我想首先弄清楚这对于该平台是否可行。 (对于 Flash 和 AIR 来说大多是新手)

我想做的是提前知道 URLRequest 将使用什么本地端口。如果可能的话,我想保持连接打开,并继续使用相同的套接字。

我基本上想要完成的是提前进行一些 NAT 遍历和端口协商。一旦我协商了客户端和服务器,我希望它们能够连接并基本上以点对点的方式使用 HTTP 来流媒体,就像这个示例:

var s = new air.Sound(); 
var url = "http://www.example.com/sounds/bigSound.mp3"; 
var req = new air.URLRequest(url); 
var context = new air.SoundLoaderContext(8000, true); 
s.load(req, context); 
s.play();

问题是我看不到这种情况发生,除非我可以从 AIR 获取有关其计划使用哪些端口的一些信息。我可以创建自己的 Socket 连接到服务器并使用它们,但我需要一种方法来利用声音框架以相同的方式从套接字进行流式传输。

有想法吗?想法?谢谢!

I'm looking at writing an app with Adobe AIR, but I wanted to figure out if this is feasible with the platform first. (Mostly new to Flash and AIR)

What I would like to do is know ahead of time what local port a URLRequest will be using. If possible, I would like to hold a connection open even and keep using the same socket.

What I'm basically trying to accomplish is doing some NAT-Traversal and port negotiation ahead of time. Once I have both the client and the server negotiated, I'd like them to connect and basically use HTTP in a peer-to-peer way to stream media, like this sample:

var s = new air.Sound(); 
var url = "http://www.example.com/sounds/bigSound.mp3"; 
var req = new air.URLRequest(url); 
var context = new air.SoundLoaderContext(8000, true); 
s.load(req, context); 
s.play();

The problem is that I don't see this happening unless I can get some information from AIR on what ports it's planning to use. I would be OK with creating my own Socket connections to the server and using them, but I would need a way to leverage the Sound framework to stream in the same way from a socket.

Ideas? Thoughts? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹊巢 2024-10-26 09:10:27

即使您设法猜测 AIR 将在您的设备上使用哪个端口,它也不会很有帮助,因为您的 NAT 很有可能会将其转换为另一个值IF您的 AIR 设备有一个私有 IP 地址。

如果您的 AIR 服务器具有公共 IP 地址,则不会发生此问题。大多数情况下,您可以将服务器的 NAT/路由器配置为按原样转发流量。来自 WAN 的端口扫描将快速告诉您使用了哪个端口。

如果您想要“劫持”由 AIR 本身创建的出站连接,那么您可能会尝试让它联系您已实现的特殊服务器对等点,该服务器将转发来自它的流量。不简单,但可能。基本上,您会收集服务器在 NAT 中打出的漏洞。

Even if you managed to guess which port AIR is going to use on your device, it is not going to be very helpful, since there is a reasonably high probability that your NAT will translate it to another value IF your AIR device has a private IP address.

This issue does not happen if your AIR server has a public IP address. Most often, you can configure the server's NAT/Router to forward traffic as is. A port scan from the WAN will quickly tell you which port is used.

If you want to 'hijack' an outbound connection created by AIR itself, then you might try to have it contact a special server peer you have implemented which will forward traffic from and to it. Not simple, but possible. Basically you would collect holes punched in the NAT by the server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文