亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gameswf_xmlsocket.cpp

?? 一個開源的嵌入式flash播放器 具體看文檔和例子就可
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// gameswf_xml.h      -- Rob Savoye <rob@welcomehome.org> 2005// This source code has been donated to the Public Domain.  Do// whatever you want with it.#include <SDL.h>#include "base/utility.h"#include "gameswf_log.h"#include "gameswf_xml.h"#include "gameswf_xmlsocket.h"#include "gameswf_timers.h"#ifdef HAVE_LIBXML#include <sys/types.h>#ifdef HAVE_WINSOCK# include <WinSock2.h># include <windows.h># include <fcntl.h># include <sys/stat.h># include <io.h>#else# include <sys/time.h># include <sys/fcntl.h># include <unistd.h># include <sys/select.h># include <netinet/in.h># include <arpa/inet.h># include <sys/socket.h># include <netdb.h># include <errno.h># include <sys/param.h># include <sys/select.h>#endif#ifndef MAXHOSTNAMELEN#define MAXHOSTNAMELEN 256#endifint xml_fd = 0;              // FIXME: This file descriptor is used by                             // XML::checkSocket() when called from the main                             // processing loop. namespace gameswf{const int SOCKET_DATA = 1;const int INBUF = 10000;XMLSocket::XMLSocket(){  //log_msg("%s: \n", __FUNCTION__);  _data = false;  _xmldata = false;  _closed = false;  _connect = false;  _processing = false;  _port = 0;  _sockfd = 0;  xml_fd = 0;}XMLSocket::~XMLSocket(){  //log_msg("%s: \n", __FUNCTION__);}boolXMLSocket::connect(const char *host, int port){  struct sockaddr_in  sock_in;  fd_set              fdset;  struct timeval      tval;  int                 ret;  int                 retries;  char                thishostname[MAXHOSTNAMELEN];  struct protoent     *proto;  if (port < 1024) {    log_error("Can't connect to priviledged port #%d!\n", port);    _connect = false;    return false;  }  log_msg("%s: to host %s at port %d\n", __FUNCTION__, host, port);    memset(&sock_in, 0, sizeof(struct sockaddr_in));  memset(&thishostname, 0, MAXHOSTNAMELEN);  if (strlen(host) == 0) {    if (gethostname(thishostname, MAXHOSTNAMELEN) == 0) {      log_msg("The hostname for this machine is %s.\n", thishostname);    } else {      log_msg("Couldn't get the hostname for this machine!\n");      return false;    }     }  const struct hostent *hent = ::gethostbyname(host);  if (hent > 0) {    ::memcpy(&sock_in.sin_addr, hent->h_addr, hent->h_length);  }  sock_in.sin_family = AF_INET;  sock_in.sin_port = ntohs(static_cast<short>(port));#if 0    char ascip[32];    inet_ntop(AF_INET, &sock_in.sin_addr.s_addr, ascip, INET_ADDRSTRLEN);      log_msg("The IP address for this client socket is %s\n", ascip);#endif  proto = ::getprotobyname("TCP");  _sockfd = ::socket(PF_INET, SOCK_STREAM, proto->p_proto);  if (_sockfd < 0)    {      log_error("unable to create socket : %s\n", strerror(errno));      _sockfd = -1;      return false;    }  retries = 2;  while (retries-- > 0) {    // We use select to wait for the read file descriptor to be    // active, which means there is a client waiting to connect.    FD_ZERO(&fdset);    FD_SET(_sockfd, &fdset);        // Reset the timeout value, since select modifies it on return. To    // block, set the timeout to zero.    tval.tv_sec = 5;    tval.tv_usec = 0;        ret = ::select(_sockfd+1, &fdset, NULL, NULL, &tval);    // If interupted by a system call, try again    if (ret == -1 && errno == EINTR)      {        log_msg("The connect() socket for fd #%d was interupted by a system call!\n",                _sockfd);        continue;      }        if (ret == -1)      {        log_msg("The connect() socket for fd #%d never was available for writing!\n",                _sockfd);#ifdef HAVE_WINSOCK        ::shutdown(_sockfd, SHUT_BOTH);#else        ::shutdown(_sockfd, SHUT_RDWR);#endif        _sockfd = -1;              return false;      }    if (ret == 0) {      log_error("The connect() socket for fd #%d timed out waiting to write!\n",                _sockfd);      continue;    }    if (ret > 0) {      ret = ::connect(_sockfd, reinterpret_cast<struct sockaddr *>(&sock_in), sizeof(sock_in));      if (ret == 0) {        log_msg("\tport %d at IP %s for fd #%d\n", port,                ::inet_ntoa(sock_in.sin_addr), _sockfd);        _connect = true;        return true;      }      if (ret == -1) {        log_msg("The connect() socket for fd #%d never was available for writing!\n",                _sockfd);        _sockfd = -1;              return false;      }    }  }  //  ::close(_sockfd);  //  return false;  printf("\tConnected at port %d on IP %s for fd #%d\n", port,          ::inet_ntoa(sock_in.sin_addr), _sockfd);  #ifndef HAVE_WINSOCK  fcntl(_sockfd, F_SETFL, O_NONBLOCK);#endif  xml_fd = _sockfd;             // FIXME: This file descriptor is used by                                // XML::checkSocket() when called from                                // the main processing loop.  _connect = true;  return true;}voidXMLSocket::close(){  log_msg("%s: \n", __FUNCTION__);  // Since the return code from close() doesn't get used by Shockwave,  // we don't care either.  if (_sockfd > 0) {    ::close(_sockfd);  }}// Return true if there is data in the socket, otherwise return false.boolXMLSocket::anydata(char **msgs){  //printf("%s: \n", __FUNCTION__);  return anydata(_sockfd, msgs);}bool XMLSocket::processingData(){  //printf("%s: processing flags is is %d\n", __FUNCTION__, _processing);  return _processing;}void XMLSocket::processing(bool x){  //printf("%s: set processing flag to %d\n", __FUNCTION__, x);  _processing = x;}boolXMLSocket::anydata(int fd, char **msgs){  fd_set                fdset;  struct timeval        tval;  int                   ret = 0;  char                  buf[INBUF];  char                  *packet;  int                   retries = 10;  char                  *ptr, *eom;  int                   pos;  int                   cr, index = 0;  static char           *leftover = 0;  int                   adjusted_size;  //log_msg("%s: \n", __FUNCTION__);  if (fd <= 0) {    return false;  }  //msgs = (char **)realloc(msgs, sizeof(char *));  while (retries-- > 0) {    FD_ZERO(&fdset);    FD_SET(fd, &fdset);        tval.tv_sec = 1;    tval.tv_usec = 10;        ret = ::select(fd+1, &fdset, NULL, NULL, &tval);    // If interupted by a system call, try again    if (ret == -1 && errno == EINTR) {      log_msg("The socket for fd #%d was interupted by a system call!\n",              fd);      continue;    }    if (ret == -1) {      log_error("The socket for fd #%d never was available!\n", fd);      return false;    }    if (ret == 0) {      //log_msg("There is no data in the socket for fd #%d!\n", fd);      return false;    }    if (ret > 0) {      //log_msg("There is data in the socket for fd #%d!\n", fd);              //break;    }    memset(buf, 0, INBUF);    ret = ::read(_sockfd, buf, INBUF-2);    cr = strlen(buf);    //log_msg("%s: read %d bytes, first msg terminates at %d\n", __FUNCTION__, ret, cr);    //log_msg("%s: read (%d,%d) %s\n", __FUNCTION__, buf[0], buf[1], buf);    ptr = buf;    // If we get a single XML message, do less work    if (ret == cr + 1) {      adjusted_size = memadjust(ret + 1);      packet = new char[adjusted_size];      //printf("Packet size is %d at %p\n", ret + 1, packet);      memset(packet, 0, adjusted_size);      strcpy(packet, ptr);      eom = strrchr(packet, '\n'); // drop the CR off the end if there is one      if (eom) {        *eom = 0;      }      //data.push_back(packet);      msgs[index] = packet;      msgs[index+1] = 0;      //printf("%d: Pushing Packet of size %d at %p\n", __LINE__, strlen(packet), packet);      processing(false);      return true;    }    // If we get multiple messages in a single transmission, break the buffer    // into separate messages.    while (strchr(ptr, '\n') > 0) {      if (leftover) {        processing(false);        //printf("%s: The remainder is: \"%s\"\n", __FUNCTION__, leftover);        //printf("%s: The rest of the message is: \"%s\"\n", __FUNCTION__, ptr);        adjusted_size = memadjust(cr + strlen(leftover) + 1);        packet = new char[adjusted_size];        memset(packet, 0, adjusted_size);        strcpy(packet, leftover);        strcat(packet, ptr);        eom = strrchr(packet, '\n'); // drop the CR off the end there is one        if (eom) {          *eom = 0;        }        //printf("%s: The whole message is: \"%s\"\n", __FUNCTION__, packet);        ptr = strchr(ptr, '\n') + 2; // messages are delimited by a "\n\0"        delete leftover;        leftover = 0;      } else {        adjusted_size = memadjust(cr + 1);        packet = new char[adjusted_size];        memset(packet, 0, adjusted_size);        strcpy(packet, ptr);        ptr += cr + 1;      } // end of if remainder      if (*packet == '<') {        //printf("%d: Pushing Packet #%d of size %d at %p: %s\n", __LINE__,        //       data.size(), strlen(packet), packet, packet);        eom = strrchr(packet, '\n'); // drop the CR off the end there is one        if (eom) {          *eom = 0;        }        //printf("Allocating new packet at %p\n", packet);        //data.push_back(packet);        msgs[index++] = packet;      } else {        log_error("Throwing out partial packet %s\n", packet);      }            //log_msg("%d messages in array now\n", data.size());      cr = strlen(ptr);    } // end of while (cr)        if (strlen(ptr) > 0) {      leftover = new char[strlen(ptr) + 1];      strcpy(leftover, ptr);      processing(true);      //printf("%s: Adding remainder: \"%s\"\n", __FUNCTION__, leftover);    }        processing(false);    printf("Returning %d messages\n", index);    return true;      } // end of while (retires)  return true;}boolXMLSocket::send(tu_string str){  //log_msg("%s: \n", __FUNCTION__);  //str += tu_string( "\0", 1);  str += '\0';  int ret = write(_sockfd, str.c_str(), str.size());  //log_msg("%s: sent %d bytes, data was %s\n", __FUNCTION__, ret, str.c_str());  if (ret == str.size()) {    return true;  } else {    return false;  }}// CallbacksvoidXMLSocket::onClose(tu_string str){  log_msg("%s: \n", __FUNCTION__);}voidXMLSocket::onConnect(tu_string str){  log_msg("%s: \n", __FUNCTION__);}voidXMLSocket::onData(tu_string str){  log_msg("%s: \n", __FUNCTION__);}voidXMLSocket::onXML(tu_string str){  log_msg("%s: \n", __FUNCTION__);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品国产亚洲aⅴ| 国产精品色哟哟网站| 在线亚洲精品福利网址导航| 国产伦精品一区二区三区免费| 免费在线观看一区| 裸体在线国模精品偷拍| 免费高清在线视频一区·| 三级不卡在线观看| 免费欧美在线视频| 国产在线精品不卡| 高清shemale亚洲人妖| 国产激情视频一区二区在线观看 | 国产伦精品一区二区三区视频青涩 | 成人av影院在线| 成年人国产精品| 日本二三区不卡| 欧美日韩精品是欧美日韩精品| 在线不卡的av| 久久先锋资源网| 亚洲色图视频网站| 亚洲va天堂va国产va久| 久久99久久久久| 成人精品免费看| 欧美在线制服丝袜| 欧美成人a∨高清免费观看| 国产日韩精品视频一区| 亚洲视频在线观看一区| 天涯成人国产亚洲精品一区av| 久久精品久久精品| 不卡一区中文字幕| 欧美日韩一区二区三区视频| 欧美本精品男人aⅴ天堂| 国产精品乱人伦一区二区| 亚洲国产婷婷综合在线精品| 石原莉奈在线亚洲二区| 国产精品系列在线播放| 欧美探花视频资源| 久久久天堂av| 亚洲午夜羞羞片| 国产精品亚洲第一| 在线成人av影院| 国产精品伦一区二区三级视频| 天堂在线一区二区| 99免费精品视频| 欧美一级欧美三级在线观看| 国产精品免费网站在线观看| 婷婷久久综合九色国产成人 | 国产日产欧美一区二区三区| 一区二区三区国产豹纹内裤在线| 久久精品国产色蜜蜜麻豆| 成人午夜激情影院| 精品久久久久久久久久久久久久久久久 | 欧美日韩国产一二三| 中文字幕久久午夜不卡| 美腿丝袜一区二区三区| 91福利国产成人精品照片| 久久青草国产手机看片福利盒子| 亚洲v中文字幕| 91视频.com| 国产精品入口麻豆原神| 久久99久久精品| 51久久夜色精品国产麻豆| 夜夜夜精品看看| 一本色道综合亚洲| 国产精品久久综合| 国产成人精品网址| 久久久久久免费毛片精品| 日韩不卡手机在线v区| 日本韩国视频一区二区| √…a在线天堂一区| 国产.欧美.日韩| 国产精品网站一区| 成人avav影音| 国产精品久久久久久久岛一牛影视 | 亚洲另类在线制服丝袜| 国产白丝精品91爽爽久久| 精品国产亚洲在线| 国产在线播精品第三| 2014亚洲片线观看视频免费| 久久精品国产亚洲一区二区三区| 欧美一级片在线看| 狠狠久久亚洲欧美| 国产亚洲综合在线| 成人免费视频视频在线观看免费 | 亚洲最新在线观看| 欧美日韩国产一级| 免费在线欧美视频| 久久人人爽爽爽人久久久| 国产麻豆午夜三级精品| 亚洲国产精品av| 色网综合在线观看| 亚洲大片精品永久免费| 欧美一区二区三区视频| 狠狠色狠狠色合久久伊人| 国产欧美中文在线| 色综合久久88色综合天天6 | 欧美精品一区二区三区一线天视频 | 成人精品视频一区| 亚洲伦理在线免费看| 欧美精品久久99| 国内国产精品久久| 亚洲婷婷综合久久一本伊一区| 色婷婷av久久久久久久| 青青草国产精品亚洲专区无| 2023国产精品视频| 色综合久久久网| 蜜桃精品视频在线观看| 国产精品麻豆一区二区| 欧美日韩高清一区二区不卡 | 欧美激情中文字幕一区二区| 色综合网站在线| 秋霞av亚洲一区二区三| 中文子幕无线码一区tr| 欧美二区乱c少妇| 波多野结衣中文字幕一区 | 国产成人免费在线| 亚洲高清视频的网址| 久久网站热最新地址| 91官网在线免费观看| 国内精品伊人久久久久av一坑 | 日韩vs国产vs欧美| 国产精品久久久99| 日韩欧美精品在线视频| 欧美在线制服丝袜| 不卡一区在线观看| 国产综合色产在线精品| 亚洲国产wwwccc36天堂| 国产精品久久久久天堂| 亚洲精品在线免费观看视频| 欧美日韩视频第一区| 成人美女视频在线观看| 久久99精品久久只有精品| 亚洲裸体在线观看| 国产精品沙发午睡系列990531| 日韩一区二区影院| 欧美日韩成人综合在线一区二区| 91色婷婷久久久久合中文| 裸体健美xxxx欧美裸体表演| 亚洲高清免费观看高清完整版在线观看| 国产日韩亚洲欧美综合| 欧美不卡一区二区三区四区| 欧美日韩一区二区在线视频| 91美女福利视频| 99热在这里有精品免费| 成人黄色大片在线观看| 国产福利一区二区三区视频在线 | 国产91精品一区二区麻豆亚洲| 日韩va欧美va亚洲va久久| 亚洲香蕉伊在人在线观| 一区二区欧美在线观看| 亚洲狠狠丁香婷婷综合久久久| 国产精品丝袜一区| 欧美高清一级片在线观看| 国产亚洲污的网站| 久久精品欧美日韩精品| 久久精品网站免费观看| 久久青草欧美一区二区三区| 国产香蕉久久精品综合网| 久久女同互慰一区二区三区| 2017欧美狠狠色| 欧美激情一区三区| 中文字幕亚洲精品在线观看| 自拍偷拍亚洲综合| 亚洲mv在线观看| 日韩国产成人精品| 精品一区二区三区免费| 国产剧情一区二区| 99re热视频精品| 欧美在线综合视频| 日韩一卡二卡三卡| 久久久高清一区二区三区| 中文幕一区二区三区久久蜜桃| 中文字幕制服丝袜成人av| 亚洲精品精品亚洲| 五月婷婷久久综合| 国内外精品视频| 色综合色综合色综合| 欧美狂野另类xxxxoooo| 亚洲精品在线观| 自拍偷拍国产精品| 日韩成人一级片| 成人一级视频在线观看| 欧美视频在线观看一区| 日韩欧美一级片| 国产精品久久99| 三级欧美韩日大片在线看| 国产河南妇女毛片精品久久久| 99久久国产免费看| 日韩视频一区二区在线观看| 中文一区在线播放| 日本不卡一二三区黄网| 成人视屏免费看| 日韩精品一区二区三区在线| 国产清纯美女被跳蛋高潮一区二区久久w | 国产精品自拍三区| 在线影视一区二区三区| 精品免费国产二区三区| 国产精品乱码久久久久久| 亚洲国产日韩a在线播放性色| 国产精品一品视频|