即使策略允许,Flash 也不会连接到套接字
在我的 Flash 应用程序中,我像这样连接到我的服务器:
Security.loadPolicyFile("xmlsocket://example.com:12860");
socket = new Socket("example.com", 12869);
socket.writeByte(...);
...
socket.flush();
在端口 12860,我正在运行套接字策略服务器,该服务器(根据 此文档)正确地提供了我的策略,如下所示:
00000000 3c 70 6f 6c 69 63 79 2d 66 69 6c 65 2d 72 65 71 <policy- file-req
00000010 75 65 73 74 2f 3e 00 uest/>.
00000000 3c 63 72 6f 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f <cross-d omain-po
00000010 6c 69 63 79 3e 3c 73 69 74 65 2d 63 6f 6e 74 72 licy><si te-contr
00000020 6f 6c 20 70 65 72 6d 69 74 74 65 64 2d 63 72 6f ol permi tted-cro
00000030 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f 6c 69 63 69 ss-domai n-polici
00000040 65 73 3d 22 6d 61 73 74 65 72 2d 6f 6e 6c 79 22 es="mast er-only"
00000050 20 2f 3e 3c 61 6c 6c 6f 77 2d 61 63 63 65 73 73 /><allo w-access
00000060 2d 66 72 6f 6d 20 64 6f 6d 61 69 6e 3d 22 2a 22 -from do main="*"
00000070 20 74 6f 2d 70 6f 72 74 73 3d 22 31 32 38 36 39 to-port s="12869
00000080 22 20 2f 3e 3c 2f 63 72 6f 73 73 2d 64 6f 6d 61 " /></cr oss-doma
00000090 69 6e 2d 70 6f 6c 69 63 79 3e 00 in-polic y>.
我没有收到任何安全警告,而在策略服务器到位之前我曾经收到过这些警告。 尽管如此,与端口 12869 的连接仍无法正常工作。它已制作(我可以使用 Wireshark 和服务器上看到),但 Flash 没有发送任何数据。
值得一提的是,SWF 本身也是由 example.com 提供的。
In my Flash app, I'm connecting to my server like this:
Security.loadPolicyFile("xmlsocket://example.com:12860");
socket = new Socket("example.com", 12869);
socket.writeByte(...);
...
socket.flush();
At port 12860 I'm running a socket policy server, which (according to this document) correctly serves up my policy like this:
00000000 3c 70 6f 6c 69 63 79 2d 66 69 6c 65 2d 72 65 71 <policy- file-req
00000010 75 65 73 74 2f 3e 00 uest/>.
00000000 3c 63 72 6f 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f <cross-d omain-po
00000010 6c 69 63 79 3e 3c 73 69 74 65 2d 63 6f 6e 74 72 licy><si te-contr
00000020 6f 6c 20 70 65 72 6d 69 74 74 65 64 2d 63 72 6f ol permi tted-cro
00000030 73 73 2d 64 6f 6d 61 69 6e 2d 70 6f 6c 69 63 69 ss-domai n-polici
00000040 65 73 3d 22 6d 61 73 74 65 72 2d 6f 6e 6c 79 22 es="mast er-only"
00000050 20 2f 3e 3c 61 6c 6c 6f 77 2d 61 63 63 65 73 73 /><allo w-access
00000060 2d 66 72 6f 6d 20 64 6f 6d 61 69 6e 3d 22 2a 22 -from do main="*"
00000070 20 74 6f 2d 70 6f 72 74 73 3d 22 31 32 38 36 39 to-port s="12869
00000080 22 20 2f 3e 3c 2f 63 72 6f 73 73 2d 64 6f 6d 61 " /></cr oss-doma
00000090 69 6e 2d 70 6f 6c 69 63 79 3e 00 in-polic y>.
I get no security warnings, which I used to get before the policy server was in place.
Still, the connection to port 12869 doesn't work. It's made (I can see with Wireshark and on the server), but no data is sent by Flash.
It might be worth knowing that the SWF itself is served from example.com as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在通过套接字发送数据之前,我需要等待连接事件。
I need to wait for the connect event before sending data over the socket.