即使策略允许,Flash也不会连接到套接字 [英] Flash doesn't connect to socket even though policy allows it
问题描述
在我的Flash应用程式中,我要这样连线到我的伺服器:
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();
在端口12860我运行套接字策略服务器,根据此文档)正确地投放了我的政策,如下所示:
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>.
我没有得到安全警告,这是我在策略服务器到位之前得到的。
仍然,到端口12869的连接不工作。它是(我可以看到与Wireshark和在服务器上),但没有数据由Flash发送。
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.
这可能值得知道SWF本身由示例.com。
It might be worth knowing that the SWF itself is served from example.com as well.
推荐答案
我需要等待connect事件,然后通过套接字发送数据。
I need to wait for the connect event before sending data over the socket.
这篇关于即使策略允许,Flash也不会连接到套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!