C++ÓëFlexÖ®¼äsocketͨÐÅpolicy file request½â¾ö·½°¸
C++winsocket·þÎñ¶Ë£¬Flex as3¿Í»§¶Ë¡£·þÎñ¶ËBind°ó¶¨IP127.0.0.1¶Ë¿Ú2020£¬ÔÚFlexÖÐʹÓÃSocket.connectÏò·þÎñÆ÷·¢ÆðÁ´½Ó¡£µ±FlexÔÚ±¾µØÔËÐеÄʱºòÄÜÁ´½Ó³É¹¦, µ«ÊÇͨ¹ýÓòÃû·ÃÎÊʱ³öÏÖSecurity´íÎó, Error #2048
¡£²¢ÇÒÔÚÁ¬½Óʱ, ·þÎñ¶ËÊÕµ½¿Í»§¶Ë·¢À´µÄÏûÏ¢<policy-file-request/>
ÏûÏ¢¡£
³¢ÊÔ½â¾ö:
ÉÏgoogleËÑË÷ÁËÈô¸É×ÊÁÏ£¬ÎÒ¿´ÁËÁ¼¾ÃÒ²Ò»Öª°ë½â¡£
³öÏÖÕâ¸öÎÊÌâµÄÔÒòÊÇFlashPlayerÓÐÒ»¸ö°²È«É³Ïä»úÖÆ
¡£±¾µØÔËÐÐswfʱ£¬flashPlayerĬÈϵݲȫ²ßÂÔÊÇ¿ÉÒÔ¿çÔ¤·ÃÎʵģ¬¿ÉÒԲ鿴Security.sandboxTypeÊôÐÔֵΪlocalTrusted¡£È»¶øÔÚʹÓÃIP·ÃÎÊswfÎļþʱ£¬flashPlayer»áÈÏΪÕâ¸öÎļþÊDz»°²È«µÄ´Ëʱ¿ÉÒԲ鿴
Security.sandboxTypeµÄÊôÐÔֵΪremote¡£´ËʱÐèÒªÔÚ·þÎñ¶Ë·ÅÖòßÂÔÎļþ£¬flashPlayer²Å»áÈÃswfÁ´½Óµ½´Ë·þÎñÆ÷¡£
Èô¸ÉÈ˵IJ©¿ÍÉ϶¼ËµÐèÒªÃûΪcrossdomain.xml
µÄÎļþ·ÅÖõ½·þÎñ¶ËHTTPµÄ¸ùĿ¼Ï¡£ÎļþÄÚÈÝΪ
<?xml version="1.0"?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="2020" />
</cross-domain-policy>
ÎÒÕâô×öÁË£¬µ«ÊÇûÓÐÈκÎЧ¹û¡££¨ÎÒÄÜÈ·¶¨²ßÂÔÎļþ±»·ÃÎʵ½ÁË£¬ÒòΪÎļþÖгöÏÖÓï·¨´íÎóµÄʱºòFlexµ÷ÊÔÐÅÏ¢Öл¹»á±¨³ö¾¯¸æ¡££©ÓÚÊÇÎÒ²ÂÏëÕâ¸ö·½·¨Ò²ÐíÊǽâ¾ö²»ÄÜ·ÃÎÊÔ¶³ÌHTTPÎļþµÄµÄÎÊÌ⣬¶øsocketͨÐÅÐèÒªÁíÍâµÄ·½·¨¡£
È»ºóÔÚCSDNÂÛ̳ÉÏ·¢ÏÖÓÐÈËÓÃJavaSocketºÍFlexͨÐųöÏÖͬÑùÎÊÌ⣬½â¾ö·½°¸ÊÇ·þÎñ¶ËÊÕµ½
<policy-file-request/>ÏûϢʱ£¬Ö±½ÓÏò¿Í»§¶Ë·¢ËÍÒ»ÌõÏûÏ¢£¬ÄÚÈݾÍÊÇÉÏÃæµÄ²ßÂÔÎļþµÄxml
¡£ÎÒ·ÂÕÕ×öÁË£¬ÒÀÈ»ÎÞЧ>_<
char szPolicy[1024] = "";
strcat_s(szPolicy, 1024, "<?xml version='1.0'?>");
strcat_s(szPolicy, 1024, "<cross-domain-policy>");
strcat_s(szPolicy, 1024, "<site-control permitted-cross-domain-policies='all'/>");
strcat_s(szPolicy, 1024, "<allow-access-from domain='*' to-ports='2020'/>");
strcat_s(szPolicy, 1024, "</cross-domain-policy>\0");
sockClient = m_sockListener.Accept(&addrClient);
if (sockClient.IsInvalid())
{
// accept failed
Ïà¹ØÎĵµ£º
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the DateTimeAxis class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.collections.ArrayCollection;
......
#include "iostream.h"
#include "stdio.h"
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
int main(int argc, char* argv[])
{
::CoInitialize(NULL);
_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance("ADODB.Connection");
tr ......
.APS£º´æ·Å¶þ½øÖÆ×ÊÔ´µÄÖмäÎļþ£¬VC°Ñµ±Ç°×ÊÔ´Îļþת»»³É¶þ½øÖƸñʽ£¬²¢´æ·ÅÔÚAPSÎļþÖУ¬ÒÔ¼Ó¿ì×ÊÔ´×°ÔØËٶȡ£×ÊÔ´¸¨ÖúÎļþ¡£
.BMP£ºÎ»Í¼×ÊÔ´Îļþ¡£
.BSC£ºä¯ÀÀÐÅÏ¢Îļþ£¬ÓÉä¯ÀÀÐÅϢά»¤¹¤¾ß£¨BSCMAKE£©´ÓÔʼä¯ÀÀÐÅÏ¢Îļþ£¨.SBR£©ÖÐÉú³É£¬BSCÎļþ¿ÉÒÔÓÃÀ´ÔÚÔ´´úÂë±à¼´°¿ÚÖнøÐпìËÙ¶¨Î»¡£ÓÃÓÚä¯ÀÀÏîÄ¿ÐÅÏ¢µÄ£¬Èç¹ûÓ ......
1.ʲôÊǺ¯Êý£¬º¯ÊýµÄÁ½ÖÖ¶¨Ò巽ʽ
2.²ÎÊý,´«ÖµºÍ´«Ö·£¬Ä¬ÈϲÎÊý¡¢²ÎÊý·ÃÎÊÐÅÏ¢ºÍ±ä³¤²ÎÊý
3.º¯ÊýµÄ±äÁ¿(È«¾ÖºÍ¾Ö²¿)
4.´úÀíº¯Êý¶ÔÏóºÍº¯ÊýÖ´ÐжÓÁÐ
5.·µ»Øº¯ÊýÀàÐͺͱհü
6.applyµÄÓ¦ÓÃ(·½·¨½Ù³Ö£¬¼Ì³ÐÊôÐÔ)
ÏÂÔصØÖ·:as3_4º¯Êý ......
Ò»¡¢C++·þÎñÆ÷¶Ë
£¨ÓõÄÊÇVisual Studio 2008£¨05£¬03µÄÓ¦¸ÃÒ²¿ÉÒÔ£¬VC++µÄ¿ÉÄÜÐèÒªÉÔ΢¸Ä¶¯£©£©
´úÂëÈçÏ£º
#include <winsock2.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
using namespace std;
#pragma comment(lib,"ws2_32.lib")
void main(){ ......