我正在尝试用C制作一个Flash游戏服务器,但是我遇到了“flash政策”部分的问题。
这是我的政策字符串:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" to-ports="1-31111" />
</cross-domain-policy>
连接发送代码+ flash策略规则:
char toSend[] = "<?xml version=\"1.0\"?>\r\n<!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\">\r\n<cross-domain-policy>\r\n<allow-access-from domain=\"*\" to-ports=\"1-31111\" />\r\n</cross-domain-policy>\0"; /* some string */
write(connfd, &toSend, sizeof(toSend));
似乎工作正常,但遗憾的是它关闭了连接并打印出一些零值的输出:
Server running...waiting for connections.
Received request...
Incoming packet: <policy-file-request/>
Received request...
Incoming packet:
Incoming packet:
谢谢