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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gui_vnc_x_startserver.c

?? UC_GUI開發(fā)源代碼,里面含有范例,源文件
?? C
字號:
/*
*********************************************************************************************************
*                                             uC/GUI V3.98
*                        Universal graphic software for embedded applications
*
*                       (c) Copyright 2002, Micrium Inc., Weston, FL
*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
*              礐/GUI is protected by international copyright laws. Knowledge of the
*              source code may not be used to write a similar product. This file may
*              only be used in accordance with a license and should not be redistributed
*              in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File        : GUI_X_StartVNC
Purpose     : Starts the VNC server via TCP/IP
              This code works with embOS and the RTIP TCP/IP stack.
              However, it can be easily modified to work with
              different kernel and IP Stack
---------------------------END-OF-HEADER------------------------------
*/

#include <stdlib.h>

#include "RTIP.H"     /* RTIP API */
#include "SOCKET.H"   /* BSD socket interface */
#include "RTOS.H"     /* embOS header */
#include "GUI.h"
#include "GUI_X.h"
#include "GUI_VNC.h"
#include "HWC.h"      /* Hardware function prototypes */

/*********************************************************************
*
*       static data
*
**********************************************************************
*/

static GUI_VNC_CONTEXT _Context;
static OS_STACKPTR int _StackVNCServer[1000];             /* embOS Stack area of the server */
static OS_TASK         _VNCServer_TCB;                    /* embOS Task-control-block of the server */

/*********************************************************************
*
*       static const
*
**********************************************************************
*/
static const unsigned char   _IPLocal[4] = {192,168,1,254};     /* IP address of the system */
static const unsigned char   _IPMask[4] =  {255,255,0,0};       /* IP mask for the system   */

/*********************************************************************
*
*             Static functions
*
**********************************************************************
*/


/*********************************************************************
*
*       _Send
*
* Function description
*   This function is called indirectly by the server; it's address is passed to the actual
*   server code as function pointer. It is needed because the server is independent
*   of the TCP/IP stack implementation, so details for the TCP/IP stack can be placed here.
* Notes:
*   (1) This implementation is for EBS's RTIP stack.
*   (2) It switches between blocking and non-blocking mode; This is due to a weekness
*       of the RTIP stack: It tries to fill up the TCP-window before sending the
*       package; but since the socket normally blocks, no more data is send to the socket
*       until a time-out expires of about 200 ms. This would slow down communication
*       dramatically and can be avoided with the "trick" below; as long as there is enough
*       space in the TCP-window, we use non-blocking mode.
*/
static int _Send(const U8* buf, int len, void* pConnectionInfo) {
  unsigned long r;                             /* Needs to be unsigned long, because ioctlsocket takes a pointer to it */
  SOCKET socket;
  unsigned long zero = 0;

  socket = (SOCKET)pConnectionInfo;
  ioctlsocket (socket, FIONWRITE, &r);
  if (r > len) {
    unsigned long one  = 1;
    ioctlsocket (socket, FIONBIO, &one); /* nonblocking */
  }
  r = send(socket, (const char*)buf, len, 0);
  ioctlsocket (socket, FIONBIO, &zero); /* blocking */
  return r;
}

/*********************************************************************
*
*       _Recv
*
* Function description
*   This function is called indirectly by the server; it's address is passed to the actual
*   server code as function pointer. It is needed because the server is independent
*   of the TCP/IP stack implementation, so details for the TCP/IP stack can be placed here.
* Notes:
*   (1) This implementation is for EBS's RTIP stack, but it should work without modification
*       on most TCP/IP stacks.
*/
static int _Recv(U8* buf, int len, void* pConnectionInfo) {
  return recv((SOCKET)pConnectionInfo, (char*)buf, len, 0);
}

/*********************************************************************
*
*       _ServerTask
*
* Function description
*   This routine is the actual server task.
*   It executes some one-time init code, then runs in an ednless loop.
*   It therefor does not terminate.
*   In the endless loop it
*     - Waits for a conection from a client
*     - Runs the server code
*     - Closes the connection
*/
static void _ServerTask(void) {
  int s, sock;
  short Port;
  struct sockaddr_in addr_in;
  const int one = 1;

  /* Prepare socket (one time setup) */
  Port = 5900 + _Context.ServerIndex;                     /* Default port for VNC is is 590x, where x is the 0-based layer index */
  addr_in.sin_family      = AF_INET;
  addr_in.sin_port        = htons(Port);
  addr_in.sin_addr.s_addr = INADDR_ANY;
  s = socket(AF_INET, SOCK_STREAM, 0);
  if (s < 0) {
    return;                                               /* Error ... We are done with this task */
  }
  if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *) &one, sizeof(one)) < 0) {
    closesocket(s);
    return;                                               /* Error ... We are done with this task */
  }
  if (bind(s, (struct sockaddr *)&addr_in, sizeof(addr_in))) {
    closesocket(s);
    return;                                               /* Error ... We are done with this task */
  }
  if (listen(s, 1)) {
    closesocket(s);
    return;                                               /* Error ... We are done with this task */
  }
  
  /* Endless loop. We run thru it once for every client connecting to us */
  while (1) {
    struct sockaddr addr;
    int addrlen;

    /* Wait for an incoming connection */
    addrlen = sizeof(addr);
    if ((sock = accept(s, &addr, &addrlen)) < 0) {
      return;                                             /* Error ... We are done with this task */
    }

    /* Disable Nagle's algorithm - improves performance (optional) */
    {
      const int zero = 0;
      setsockopt(sock, SOL_SOCKET, SO_NAGLE, (const char *) &zero, sizeof(zero));
    }
    /* Run the actual server */
    GUI_VNC_Process(&_Context, _Send, _Recv, (void*)sock);

    /* Close the connection */
    closesocket(sock);
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/

/*********************************************************************
*
*             GUI_VNC_X_StartServer
*
* Function description
*   To start the server, the following steps are executed
*   - Make sure the TCP-IP stack is up and running
*   - Init the server context and attach it to the layer
*   - Start the thread (task) which runs the VNC server
* Notes:
*   (1) The first part of the code initializes the TCP/IP stack. In a typical
*       application, this is not required, since the stack should have already been
*       initialized some other place.
*       This could be done in a different module. (TCPIP_AssertInit() ?)
*/
int GUI_VNC_X_StartServer(int LayerIndex, int ServerIndex) {
  /* Make sure the TCP/IP stack is initialized.  (1) */
  if (xn_rtip_init() != 0) {
    OS_SendString("GUI_VNC_X_StartServer: Init failed\n");
    return 1;                    /* Error */
  }
  {
    int interface;
    xn_bind_cs(0);                                        /* append interface to device table */
    interface = xn_interface_open_config(CS89X0_DEVICE, 0, (IOADDRESS)0x20000300,5,0);   /* open interface */
    if (interface < 0) {
      OS_SendString("GUI_VNC_X_StartServer: Can not open interface\n");
      return 1;                                           /* Error */
    }
    xn_set_ip(interface, (PFBYTE)&_IPLocal[0], (PFBYTE)&_IPMask[0]);      /* set IP address of interface */
    HW_EnableEthernetIRQ();                               /* Enable ethernet IRQ. Make sure it is done after xn_interface_open_config() */  
  }

  /* Init VNC context and attach to layer (so context is updated if the display-layer-contents change */
  GUI_VNC_AttachToLayer(&_Context, LayerIndex);
  _Context.ServerIndex = ServerIndex;

  /* Create task for VNC Server */
  OS_CREATETASK(&_VNCServer_TCB, "VNC Server", _ServerTask, 50, _StackVNCServer);
  return 0;                                               /* O.k., server has been started */
}
/*************************** End of file ****************************/

	 	 			 		    	 				 	  			   	 	 	 	 	 	  	  	      	   		 	 	 		  		  	 		 	  	  			     			       	   	 			  		    	 	     	 				  	 					 	 			   	  	  			 				 		 	 	 			     			 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久看| 欧美成人精精品一区二区频| 中文字幕日本不卡| 99久久精品国产导航| 亚洲婷婷国产精品电影人久久| 99re亚洲国产精品| 亚洲伊人伊色伊影伊综合网| 欧美精品aⅴ在线视频| 蜜臀av性久久久久蜜臀aⅴ流畅 | 久久精品一区二区三区不卡 | 国产精品久久久久久久久久免费看 | 欧美一区二区三区四区久久| 蜜乳av一区二区三区| 久久综合久久久久88| 成人综合日日夜夜| 樱花草国产18久久久久| 欧美丰满少妇xxxxx高潮对白| 九色综合国产一区二区三区| 久久婷婷久久一区二区三区| 99久久精品国产导航| 视频在线在亚洲| 国产日产亚洲精品系列| 91福利视频在线| 久久99热狠狠色一区二区| 国产精品久久久久影院| 欧美日韩高清一区二区| 国产成人a级片| 丝袜a∨在线一区二区三区不卡| 日韩精品一区二区三区在线| 国产99精品国产| 亚洲电影欧美电影有声小说| 久久精品男人天堂av| 91福利社在线观看| 国产精品一区专区| 亚洲bt欧美bt精品| 国产精品国产自产拍高清av| 日韩视频在线你懂得| 91香蕉视频黄| 国产一区二区三区在线观看免费| 亚洲一区精品在线| 中文字幕欧美三区| 日韩欧美一级二级三级久久久| 99国产麻豆精品| 久久99九九99精品| 亚洲成人久久影院| 亚洲欧洲99久久| 久久久久一区二区三区四区| 欧美日韩大陆在线| 色综合久久中文字幕| 成人一区二区三区视频| 老司机精品视频在线| 亚洲国产日韩精品| 亚洲免费在线电影| 欧美国产综合色视频| 精品久久久久久无| 51精品秘密在线观看| 一本一本大道香蕉久在线精品 | 国产日产欧美一区| 欧美大度的电影原声| 欧美日韩大陆在线| 91黄色免费观看| 99视频精品全部免费在线| 国产乱码精品一品二品| 天使萌一区二区三区免费观看| 亚洲人成伊人成综合网小说| 中文字幕中文字幕一区二区| 久久久精品国产免费观看同学| 777xxx欧美| 制服.丝袜.亚洲.另类.中文| 欧美无砖专区一中文字| 91免费视频大全| 99精品欧美一区二区三区小说| 成人性视频免费网站| 国产在线视视频有精品| 精品无码三级在线观看视频| 蜜桃一区二区三区在线观看| 美女任你摸久久| 麻豆精品新av中文字幕| 精品亚洲国产成人av制服丝袜| 久久国产视频网| 激情都市一区二区| 国产精品一区在线| 国产成人日日夜夜| 不卡欧美aaaaa| av资源站一区| 色婷婷av一区二区三区大白胸| caoporm超碰国产精品| 成人午夜激情片| 色综合婷婷久久| 欧美三级视频在线观看| 欧美三级日韩三级国产三级| 欧美色涩在线第一页| 在线成人av影院| 精品国产乱码久久久久久久| 国产欧美一区二区三区在线老狼| 国产精品青草久久| 亚洲美女视频在线| 日韩国产一区二| 国产精品亚洲综合一区在线观看| av一本久道久久综合久久鬼色| 在线精品视频免费播放| 欧美一区二区网站| 国产亚洲成av人在线观看导航| 国产精品卡一卡二卡三| 一区二区日韩电影| 久久国产精品第一页| 国产不卡免费视频| 欧美在线不卡视频| 日韩欧美不卡一区| 国产精品进线69影院| 亚洲国产日日夜夜| 国产乱一区二区| 91国在线观看| 久久久久久久久久美女| 亚洲一区二区三区在线看| 美女视频一区在线观看| 成人一级片在线观看| 欧美区视频在线观看| 国产免费久久精品| 亚洲国产精品自拍| 国产成人精品三级麻豆| 欧美乱妇一区二区三区不卡视频| 久久久久久久久久久久久久久99 | 同产精品九九九| 国产99一区视频免费| 欧美疯狂性受xxxxx喷水图片| 国产嫩草影院久久久久| 日本伊人色综合网| 色香色香欲天天天影视综合网| 精品少妇一区二区三区日产乱码 | 欧美一区三区四区| 成人免费在线播放视频| 久久国内精品自在自线400部| 91搞黄在线观看| 国产精品免费丝袜| 久久精品99久久久| 欧美日韩国产一区| 中文字幕制服丝袜一区二区三区| 男人的j进女人的j一区| 91国内精品野花午夜精品| 26uuu成人网一区二区三区| 午夜视频一区在线观看| 91影院在线观看| 欧美激情一区二区三区蜜桃视频 | 亚洲欧美在线视频| 国产精品亚洲专一区二区三区| 91.com视频| 一区二区三区中文字幕精品精品| 国产精品一区二区三区网站| 日韩一区二区影院| 香蕉久久一区二区不卡无毒影院 | 国产成人日日夜夜| 久久综合久久鬼色中文字| 麻豆精品视频在线观看视频| 91精品国产综合久久久蜜臀图片| 一区二区三区在线高清| 99re这里只有精品视频首页| 国产精品三级av在线播放| 国产精品一区久久久久| 久久久久久影视| 国产精品伊人色| 国产日韩成人精品| www.欧美亚洲| 亚洲欧洲日韩一区二区三区| 大桥未久av一区二区三区中文| 国产欧美一二三区| 成人午夜免费视频| 日韩理论在线观看| 99re成人精品视频| 一区二区三区日韩欧美| 欧美最猛性xxxxx直播| 亚洲四区在线观看| 色天使色偷偷av一区二区| 亚洲人被黑人高潮完整版| 91麻豆免费在线观看| 有码一区二区三区| 欧美三级中文字| 日韩中文字幕不卡| 精品国产乱码久久久久久夜甘婷婷 | 国产精品美女久久久久aⅴ国产馆| 国产成人日日夜夜| 中文字幕佐山爱一区二区免费| 色综合久久久久综合99| 亚洲一二三四在线| 欧美一级黄色大片| 黄色日韩三级电影| 亚洲国产高清不卡| 欧美在线播放高清精品| 日欧美一区二区| 国产亚洲一二三区| 91视频观看视频| 亚洲国产va精品久久久不卡综合| 欧美军同video69gay| 激情欧美一区二区| 国产电影一区在线| 色综合天天综合色综合av | 精品国产精品网麻豆系列| 国产99一区视频免费| 一区二区三区不卡视频 | 欧美日韩久久一区二区|