Flash / AS2 套接字策略文件问题

发布于 2024-08-22 17:02:05 字数 715 浏览 9 评论 0原文

几天来我一直在尝试在 Flash 客户端和 Java 服务器之间建立连接,但在使用套接字策略服务器时遇到了问题。

我已经在线阅读了大量信息(包括有关如何创建信息的 Adob​​e 指南),但除了 CS3 中的“测试电影”选项外,我仍然无法连接它。

客户端和服务器的源代码很长,所以我将尝试解释它们的作用。

好的,基本上我在 java 服务器中收到 的请求,然后发送“" (尝试了许多其他 xml 文件)后跟一个空字符(但保持连接打开) ,已尝试关闭它 - 仍然不起作用)。然而,Flash 客户端似乎仍然继续尝试连接大约 10 秒,然后才放弃。

我还在java服务器内设置了一个迷你Web服务器,当发出http样式的请求时,它在同一端口上提供一个网页,这似乎有效,所以它不可能是端口转发问题。

我还尝试了 Adob​​e 示例端口 843 服务器,仍然无法正常工作。当在 firefox/safari 中访问 html 文件时,我可以手动批准连接,并且它可以工作。

我读到套接字连接不需要 crossdomain.xml,但仍然进行了实验。

你认为我哪里可能会出错?

I've been trying to establish a connection between my flash client and java server for a few days now, but having trouble with the socket policy server.

I've read a lot of info online (including the Adobe guide on how to create one) but still I can't get it to connect, other than in the "Test Movie" option in CS3.

The source for the client and server are pretty long, so I will just try to explain what they do.

OK, so basically I receive the request for <policy-file-request/> in my java server, then I send "<cross-domain-policy><allow-access-from domain='*' to-ports='*' /></cross-domain-policy>" (tried numerous other xml files) followed by a null character (but keep the connection open, have tried closing it - still didn't work). It seems, however, that the flash client still continues trying to connect for about 10 seconds before giving up.

I also set up a mini-web server inside the java server, which serves a web page on the same port when issued an http-style request, and this seems to work, so it can't be a port-forwarding issue.

I also tried the Adobe example port 843 server, which still didn't work. When accessing the html file in firefox/safari, I can manually approve the connection, and it works.

I read that a crossdomain.xml isn't required for a socket connection, but have experimented none the less.

Where do you think I could be going wrong here?

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

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

发布评论

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

评论(1

-残月青衣踏尘吟 2024-08-29 17:02:05

好吧,我不使用 java,但我可能会建议两个起点。

首先,检查域和端口配置上的双引号 (") 替换是否存在问题。即:在 VB 中,我们确实可以使用 chr(34) 来实现此目的。看一下:

sock.SendData "<cross-domain-policy><allow-access-from domain=" & Chr(34) & "*" & Chr(34) & "to-ports=" & Chr(34) & "50505" & Chr(34) & "/></cross-domain-policy>" & Chr(0)

其次,跟踪我发现的应用程序Flash 播放器在收到策略文件的答案后“断开连接”并重新连接,因此顺序如下:

服务器接收带有消息“policy-file-request/”的请求。
服务器响应策略文件
然后...它断开连接(!)(?)
然后它再次连接(自动)

技巧是在 VB 中我们应该在 sock_Close() 事件上关闭套接字,例如:

Private Sub sock_Close()
sock.Close                          ' has to be called
sock.Listen                         ' listen again

End Sub

希望它有帮助。

well i do not use java, but i may suggest two starting points.

First, check if there's a problem with the replacemento of double cotes (") on domain and port configuration. I.e: In VB we may use chr(34) for this indeed. Take a look:

sock.SendData "<cross-domain-policy><allow-access-from domain=" & Chr(34) & "*" & Chr(34) & "to-ports=" & Chr(34) & "50505" & Chr(34) & "/></cross-domain-policy>" & Chr(0)

Second, tracing my app i've found that the flash player 'disconnects' and recconects after receiving the answer for his policy-file. So the sequence is as this:

Server receive request with the msg "policy-file-request/"
Server responds the policy file
then... it disconnects (!)(?)
then it connects again (automaticaly)

The trick is in VB we should close the socket on a sock_Close() event, such as this:

Private Sub sock_Close()
sock.Close                          ' has to be called
sock.Listen                         ' listen again

End Sub

Hope it helps.

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