AS3套接字-策略文件 [英] AS3 Sockets - Policy Files

查看:74
本文介绍了AS3套接字-策略文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个微型服务器在端口843上监听< policy-file-request/> 然后,我发送以下内容:

I have a mini server listening on port 843 for <policy-file-request/> I then send down the following:

<cross-domain-policy>
<allow-access-from domain="*" to-ports="*"/>
</cross-domain-policy>

在我的Flash端,连接代码看起来像

On my flash side the connection code looks like

m_socket = new Socket("127.0.0.1", 4600);
m_socket.addEventListener(ProgressEvent.SOCKET_DATA, OnSockData);

m_socket.writeUTFBytes(String.fromCharCode(255) + String.fromCharCode(0));
m_socket.flush();

我有一个侦听端口4600的单独服务器,该服务器希望从客户端获取字符255,但从不发送.在端口4600上已建立连接,但从不发送数据.

I have a separate server listening on port 4600 that expects to get the char 255 from the client but it is never sent. The connection on port 4600 is established but the data is never sent.

端口843上的小型服务器已成功从客户端获取连接并发送了策略文件.

The mini server on port 843 is successfully getting the connection from the client and sending the policy file as well.

因此,策略文件提交存在一些问题(我不确定如何检入AS3).或选项2是由于某种原因在初始连接过程中丢失了数据.

So either there is some problem with the policy file submission (which I'm not sure how to check in AS3). Or option 2 is that for some reason data is being lost during the initial connection process.

P.S.如果我不在端口843上运行小型服务器,则端口4600上的服务器将收到策略文件请求(按照AS3协议).

P.S. If I don't run the mini server on port 843 the server on port 4600 will receive the policy file request (as per AS3 protocol).

对于在此处检查内容的任何提示,我将不胜感激.我不确定出了什么问题.我一直在通过Flash调试器进行所有操作,直到现在不需要策略文件请求之类的东西.

I would appreciate any tips on what to check here. I'm not sure what is going wrong. I had been doing everything through the flash debugger and didn't need the policy file request stuff until now.

推荐答案

您可能需要带有doctypes的完整XML.另外,您可能还需要限制端口.试试这个:

You might need the full XML with doctypes. Also, you might need to actually restrict the port as well. Try this:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy><allow-access-from domain="*" to-ports="4600" /></cross-domain-policy>

尝试 m_socket.addEventListener(Event.CONNECT,connectHandler); ,然后创建 connectHandler 函数来发送数据.

try m_socket.addEventListener(Event.CONNECT, connectHandler); and then create the connectHandler function to send your data.

这篇关于AS3套接字-策略文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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