我正在编写一个具有Flash客户端的套接字服务器。但是,我无法通过Flash政策请求。
我的代码:
if (buf[0] == 60) {
printf("Policy request spotted");
const auto& policy = Server::policy();
send(client, &policy, policy.size() + 1, 0);
close(client);
break;
}
std::string Server::policy(){
char c = 0;
return "<?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>" + c;
}
Doensn似乎有效。我需要做些什么来解决它?
感谢。
答案 0 :(得分:0)
我通过使用它来修复它:
char policy[] = "<?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";
send(client, &policy, sizeof(policy), 0);
在if (buf[0] == 60) {
声明中。