ÀûÓÃSocketʵÏÖC++ÓëFlexͨÐÅ
ÀûÓÃSocketʵÏÖC++ÓëFlexͨÐÅ
Ò»¡¢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(){
WORD wVersionRequested;
WSADATA wsaData;
int err;
short port=1300;//¶Ë¿ÚºÅ
wVersionRequested = MAKEWORD( 1, 1 );
err = WSAStartup( wVersionRequested, &wsaData );//³õʼ»¯Ì×½Ó×Ö
if ( err != 0 )
{
return;
}
if ( LOBYTE( wsaData.wVersion ) != 1 || HIBYTE( wsaData.wVersion ) != 1 )
{
WSACleanup( );
return;
}
SOCKET sockSrv=socket(AF_INET,SOCK_STREAM,0);//´´½¨Ì×½Ó×Ö
SOCKET sockConn;//ÓÃÀ´ºÍ¿Í»§¶ËͨÐŵÄÌ×½Ó×Ö
SOCKADDR_IN addrSrv;//ÓÃÀ´ºÍ¿Í»§¶ËͨÐŵÄÌ×½Ó×ÖµØÖ·
addrSrv.sin_addr.S_un.S_addr=htonl(INADDR_ANY);
addrSrv.sin_family=AF_INET;
addrSrv.sin_port=htons(port);
bind(sockSrv,(SOCKADDR*)&addrSrv,sizeof(SOCKADDR));//°ó¶¨¶Ë¿Ú
listen(sockSrv,5);//ÕìÌý
printf("Server %d is listening......\n",port);
SOCKADDR_IN addrClient;
int len=sizeof(SOCKADDR);
char buf[4096];//½ÓÊÕµÄÊý¾Ý
char rbuf[100]="³É¹¦";//·µ»ØµÄÊý¾Ý
while(1)
{
//½ÓÊÜÁ¬½Ó
sockConn=accept(sockSrv,(SOCKADDR*)&addrClient,&len);
printf("Accept connection from %s\n",inet_ntoa(addrClient.sin_addr));
//½ÓÊÕÊý¾Ý
int bytes;
if((bytes=recv(sockConn,buf,sizeof(buf),0))==
Ïà¹ØÎĵµ£º
<?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;
......
1:µ±ÓÃhttp://xxxxx/xxx.mxml?name=hermit·½Ê½·ÃÎÊ ¿ÉÒÔÓÃthis.parameters.nameÕâÖÖ·½Ê½ÔÚflexÀïÃæÈ¡url²ÎÊý
2:µ±ÓÃhttp://xxxxx/xxx.swf?name=hermit·½Ê½·ÃÎÊ ¿ÉÒÔÓÃthis.parameters.nameÕâÖÖ·½Ê½ÔÚflexÀïÃæÈ¡url²ÎÊý
3:µ±ÓÃhttp://xxxxx/xxx.html?name=hermit·½Ê½·ÃÎÊ ¿ÉÒÔÓÃthis.parameters.nameÕâÖÖ·½Ê½ÔÚflexÀïÃæÈ ......
TypeError: Error #1034: 強ÖÆÐÍ変換¤Ëʧ敗¤·¤Þ¤·¤¿¡£jp.co.nec.necst.pi.ap2web::TestEvent@1645ee79 ¤ò jp.co.nec.necst.pi.ap2web.TestEvent ¤Ë変換¤Ç¤¤Þ¤»¤ó¡£
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispat ......
ÔÚFlexÀһ°ãµÄµ¯³ö´°¿Ú£¨³ýÁËAlertÒÔÍ⣩¶¼¿ÉÒÔÓÃTitleWindow×é¼þÍê³É£¬Ö÷´°¿ÚºÍTitleWindowµÄÊý¾Ý´«Êä¿ÉÒÔÓÃÒÔÏ·½·¨£º
¼ÙÉèTitleWindowµÄʵÀýÎļþΪtitleWin.mxml£¬ÔòÒªÔÚApplicationÖÐÓÃPopUpManager´´½¨Ò»¸ötitleWinµÄÒýÓÃ
private var popWin:titleWin = titleWin(PopUpManager.createPopUp(this,titleWin,true)) ......