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

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

?? server.c

?? 程序員源碼大全 程序員源碼大全 程序員源碼大全
?? C
?? 第 1 頁 / 共 2 頁
字號:
     MessageBox (*hWnd, errorBuf, lpBuffer,
                 MB_ICONINFORMATION | MB_OK | MB_APPLMODAL);
     };

                                       // Block until a client connects.
   ConnectNamedPipe(hPipe, NULL);

                                       // Create and init overlap for writing.
   hEventWrt = CreateEvent (NULL, TRUE, FALSE, NULL);
   memset (&OverLapWrt, 0, sizeof(OVERLAPPED));
   OverLapWrt.hEvent = hEventWrt;

                                       // Set the clientIndex, then increment
                                       // the count.  Fill in the structure
                                       // for this client in the array.
   clientIndex = clientCount++;
   clients[clientIndex].hPipe   = hPipe;
   clients[clientIndex].live    = TRUE;
   clients[clientIndex].overLap = OverLapWrt;
   clients[clientIndex].hEvent  = hEventWrt;

                                       // Create and init overlap for reading.
   hEventRd = CreateEvent(NULL,TRUE,FALSE,NULL);
   memset (&OverLapRd, 0, sizeof(OVERLAPPED));
   OverLapRd.hEvent = hEventRd;

                                       // Read from the client, the first
                                       // first message should always be
                                       // the clients user name.
   retCode = ReadFile (hPipe, inBuf, PLEASE_READ, &bytesRead, &OverLapRd);

   if (!retCode)
    lastError = GetLastError();

   if (lastError == ERROR_IO_PENDING)  // Wait on read if need be.
     WaitForSingleObject (hEventRd, (DWORD)-1);

                                       // Put client's name in the array.
   strcpy (clients[clientIndex].Name, inBuf);

                                       // Create a thread which will make
                                       // another server instance of the
                                       // named pipe.
   CreateThread ((LPSECURITY_ATTRIBUTES)NULL,        // No security attributes.
                 (DWORD)0,                           // Use same stack size.
                 (LPTHREAD_START_ROUTINE)ServerProc, // Thread procedure.
                 (LPVOID)hWnd,                       // Parameter to pass.
                 (DWORD)0,                           // Run immediately.
                 (LPDWORD)&ServerThreadID);          // Thread identifier.

   TellAll("");                        // Forces a paint, draws a red spool
                                       // and name for this client.

                                       // Do loop which basically reads from
                                       // this specific client, and then
                                       // uses TellAll() to broadcast the
                                       // message to all the connected
                                       // clients.
   do{
                                       // Read the pipe.
      retCode = ReadFile (hPipe, inBuf, PLEASE_READ, &bytesRead, &OverLapRd);

                                       // Check for three kinds of errors:
                                       // If Error = IO_PENDING, wait til
                                       // the event handle signals success,
                                       // If BROKEN_PIPE, exit the do loop.
                                       // Any other error, flag it to the
                                       // user and exit the do loop.
      if (!retCode)
        {
        lastError = GetLastError();

        switch (lastError)
          {
                                       // IO_PENDING, wait on the event.
           case ERROR_IO_PENDING:
             WaitForSingleObject (hEventRd, (DWORD)-1);
             break;
                                       // Pipe is broken, exit the loop.
           case ERROR_BROKEN_PIPE:
             ExitLoop = TRUE;
             break;
                                       // Something else is wrong, exit the
                                       // the loop after telling the user.
           default:
             LoadString(hInst, IDS_READERROR, lpBuffer, sizeof(lpBuffer));
             wsprintf (errorBuf, lpBuffer, lastError);
             LoadString(hInst, IDS_DEBUGINFO, lpBuffer, sizeof(lpBuffer));
             MessageBox (*hWnd, errorBuf, lpBuffer, MB_OK);
             ExitLoop = TRUE;
             break;
          }
        }

      if (!ExitLoop)
        {
        GetOverlappedResult (hPipe, &OverLapRd, &bytesTransRd, FALSE);

                                       // Use TellAll to broadcast the message.
        if (bytesTransRd)
          TellAll(inBuf);
        else
          TellAll("");
        }

   }while(!ExitLoop);

   clients[clientIndex].live = FALSE;  // Turns spool gray.
   CloseHandle (hPipe);                // Close handles.
   CloseHandle (hEventRd);
   CloseHandle (hEventWrt);
   DisconnectNamedPipe (hPipe);        // Close pipe instance.
   ExitThread(0);                      // Clean up and die.
  }


/*  To write the buffer (input parameter) to all of the clients listed
    in the global array "clients". Clients is a global array which hold information on each client
    connected to the named pipe.  This procedure recieves a buffer.
    It then steps through this global array, and for each client it
    writes the buffer.  */

VOID TellAll( CHAR *buffer )
  {
    DWORD i;                           // Index through array.
    DWORD bytesWritten;                // Used in WriteFile().
    DWORD retCode;                     // Traps return codes.
    CHAR  Buf[LINE_LEN];               // Message Buffer.
    DWORD lastError;                   // Traps returns from GetLastError().

    for(i=0; i < clientCount; i++)     // For all clients in the array.
      {
                                       // If client isn't alive, don't waste
                                       // time writing to it.
      if (clients[i].live)
        {
        retCode = WriteFile (clients[i].hPipe, buffer, strlen(buffer),
                             &bytesWritten, &clients[i].overLap);

                                       // Check 3 kinds of errors: IO_PENDING,
                                       // NO_DATA, or other.  Wait on event
                                       // handle if IO_PENDING, else, if it's
                                       // anything other than NO_DATA (pipe
                                       // client disconnected), flag the user.
                                       // In any case, if it's not IO_PENDING,
                                       // clients[i].live = FALSE, spool turns
                                       // gray.
        if (!retCode)
          {
          lastError = GetLastError();

                                       // IO_PENDING, wait on event handle.
          if (lastError == ERROR_IO_PENDING)
            {
            WaitForSingleObject (clients[i].hEvent, (DWORD)-1);
            }
          else
            {
                                       // If not NO_DATA, flag user.
            if (lastError != ERROR_NO_DATA)
              {
              LoadString(hInst, IDS_DEBUGLAST, lpBuffer, sizeof(lpBuffer));
              wsprintf (Buf, "%s = %d", buffer, GetLastError());
              MessageBox(hWnd, Buf, lpBuffer, MB_OK);
              }
            clients[i].live = FALSE;
            }
          }
        } //if client.live
      } // for loop
                                       // Paint window with new information.
    InvalidateRect(hWnd, NULL, TRUE);
  }



/*
    To draw one of four bitmaps for each client, depending upon the clients
    status (alive = red spool, dead or disconnected = gray), and location in
    the array.  It also draws the clients user name beside the spool.
    This procedure is executed when the WM_PAINT message is trapped.  */

VOID DrawBranch(HDC hDC)
{
                                       // Spool bitmaps.
  HBITMAP hEndLive, hEndDead, hMidLive, hMidDead, hBitMap;

  HDC hDCMem;
  int X, Y;
  BITMAP bm;
  POINT ptSize, ptOrg;
  DWORD index;

                                       // Load bitmaps: two red (live),
                                       // two dead (gray).  End = end
                                       // of tree (last client to connect),
                                       // mid means in the middle somewhere.
       hEndLive = LoadBitmap (hInst, "EndLive");
       hEndDead = LoadBitmap (hInst, "EndDead");

       hMidLive = LoadBitmap (hInst, "MidLive");
       hMidDead = LoadBitmap (hInst, "MidDead");

                                       // For each client, determine if
                                       // if alive or not, and position;
                                       // then blt appropriate map and
                                       // clients name.
    for (index = 0; index < clientCount; index++)
      {

      if (index < clientCount - 1)     // ClientCount - 1 = last (end) client.
       {
        if(clients[index].live)        // If live = red, else = gray.
         hBitMap = hMidLive;
        else
         hBitMap = hMidDead;
       }
      else
       {
        if(clients[index].live)        // If live = red, else = gray.
         hBitMap = hEndLive;
        else
         hBitMap = hEndDead;
       }
                                       // Calculate coordinates:
      X = BITMAP_X;                    // X position is constant.
      Y = index * BITMAP_Y;            // Y is based on index in the array.

                                       // Blt the chosen map.
      hDCMem = CreateCompatibleDC(hDC);
      SelectObject(hDCMem, hBitMap);
      SetMapMode(hDCMem, GetMapMode(hDC));

      GetObject(hBitMap, sizeof(BITMAP), &bm);

      ptSize.x = bm.bmWidth;
      ptSize.y = bm.bmHeight;
      DPtoLP (hDC, &ptSize, 1);

      ptOrg.x = 0;
      ptOrg.y = 0;
      DPtoLP (hDCMem, &ptOrg, 1);

      BitBlt(hDC, X, Y, ptSize.x, ptSize.y,
             hDCMem, ptOrg.x, ptOrg.y, SRCCOPY);


      X =  NAME_X;                     // Relocate X,Y for clients name.
      Y += NAME_Y;
                                       // Write name next to spool.
      TextOut (hDC, X, Y, clients[index].Name, strlen(clients[index].Name));
      DeleteDC(hDCMem);
      }


}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久精品tv| 国产一区 二区| 欧美在线观看一区二区| 亚洲久草在线视频| 欧美丝袜丝交足nylons| 一区二区三区免费观看| 欧美午夜宅男影院| 日韩福利电影在线观看| 精品成人在线观看| 丁香天五香天堂综合| 国产精品国产三级国产aⅴ中文| av一区二区久久| 亚洲欧美偷拍另类a∨色屁股| 欧美中文字幕一区| 蜜桃一区二区三区在线观看| 久久精品在线观看| 色欧美88888久久久久久影院| 五月激情丁香一区二区三区| 亚洲精品一区二区在线观看| 成人少妇影院yyyy| 一二三区精品福利视频| 日韩一区二区麻豆国产| 国产精品一区二区三区网站| 亚洲欧美日韩综合aⅴ视频| 欧美男生操女生| 国产成人精品一区二| 亚洲一区精品在线| 久久嫩草精品久久久精品| 色婷婷av一区二区三区gif| 免费成人av在线播放| 中文字幕国产精品一区二区| 欧美日韩mp4| 成人综合在线网站| 欧美bbbbb| 亚洲乱码国产乱码精品精小说 | 另类人妖一区二区av| 中文在线一区二区| 欧美一区三区四区| 成人激情开心网| 午夜精品福利一区二区三区蜜桃| 国产精品人人做人人爽人人添| 欧美精品日韩一区| 99国产精品久久久久久久久久久| 美腿丝袜亚洲色图| 亚洲激情成人在线| 欧美国产精品中文字幕| 日韩三级中文字幕| 日本韩国一区二区| 波多野结衣中文字幕一区| 经典三级一区二区| 日韩中文字幕不卡| 亚洲一区在线视频观看| 久久精品国产99| 亚洲综合在线视频| 国产精品日韩精品欧美在线| 精品国产乱码久久| 在线成人av网站| 91女人视频在线观看| 国产成人激情av| 久久国产福利国产秒拍| 婷婷丁香久久五月婷婷| 91麻豆精东视频| 国产凹凸在线观看一区二区| 精久久久久久久久久久| 久久精品久久99精品久久| 五月天亚洲婷婷| 亚洲一级片在线观看| 亚洲天堂2016| 国产精品美女久久久久久2018| 欧美精品一区男女天堂| 精品国产91洋老外米糕| 欧美成人艳星乳罩| 欧美电视剧在线观看完整版| 日韩写真欧美这视频| 欧美一区二区视频在线观看2020 | 亚洲韩国精品一区| 一区二区三区蜜桃网| 亚洲激情中文1区| 悠悠色在线精品| 亚洲高清中文字幕| 天堂影院一区二区| 视频一区二区欧美| 日本不卡在线视频| 蜜桃视频一区二区三区在线观看| 青娱乐精品视频| 精品一区二区国语对白| 国产成人亚洲综合a∨婷婷图片| 国产一区二区精品久久| 国产精品自产自拍| 成人午夜免费视频| 色婷婷综合久久久久中文一区二区 | 亚洲免费伊人电影| 亚洲综合成人在线视频| 亚洲bdsm女犯bdsm网站| 欧美一区三区二区| 26uuu久久综合| 中文字幕av在线一区二区三区| 自拍av一区二区三区| 性久久久久久久| 美国十次了思思久久精品导航| 国产一区二区三区四区五区入口 | 夜夜精品浪潮av一区二区三区| 亚洲一区二区三区自拍| 日本亚洲三级在线| 国产精品18久久久久久久网站| 成av人片一区二区| 欧美调教femdomvk| 精品久久99ma| 亚洲欧洲综合另类在线| 免费不卡在线视频| 成人精品视频.| 欧美日韩国产123区| 国产日产欧美一区二区视频| 亚洲视频狠狠干| 免费观看91视频大全| 99视频在线精品| 91精品国产综合久久精品性色 | 国产精品色哟哟| 亚洲国产精品影院| 国产精品 日产精品 欧美精品| 91欧美一区二区| 欧美大片在线观看| 樱桃视频在线观看一区| 狠狠色狠狠色综合系列| 欧美在线观看一区| 国产无人区一区二区三区| 亚洲国产sm捆绑调教视频 | 日韩国产高清在线| 成人avav在线| 欧美变态tickling挠脚心| 亚洲最快最全在线视频| 精品国产一区二区三区忘忧草| 亚洲欧美视频在线观看视频| 加勒比av一区二区| 精品视频色一区| 欧美国产精品一区| 乱一区二区av| 欧美日韩精品一区二区三区| 国产精品久久久久久久久图文区| 日本美女一区二区三区视频| 91国模大尺度私拍在线视频| 国产精品人成在线观看免费| 久草在线在线精品观看| 欧美日韩dvd在线观看| 亚洲品质自拍视频| 成人一道本在线| 欧美精品一区二区久久久| 日韩高清不卡一区二区三区| 欧美在线观看视频在线| 日韩一区有码在线| 成人中文字幕在线| 国产网红主播福利一区二区| 久久99精品视频| 91精品国产品国语在线不卡| 亚洲国产乱码最新视频| 99视频精品在线| 国产精品免费久久| 国产91综合网| 国产亚洲综合性久久久影院| 黄色小说综合网站| 精品播放一区二区| 精品在线你懂的| 日韩亚洲欧美在线| 蜜桃精品视频在线| 欧美mv和日韩mv国产网站| 日本少妇一区二区| 欧美一区二区三区婷婷月色| 日韩不卡手机在线v区| 在线播放视频一区| 日韩精品五月天| 欧美久久一二三四区| 天使萌一区二区三区免费观看| 欧美乱熟臀69xxxxxx| 首页综合国产亚洲丝袜| 正在播放亚洲一区| 麻豆视频观看网址久久| 欧美精品一区二区三区一线天视频| 蜜臀av一级做a爰片久久| ww久久中文字幕| 国产精品一区二区免费不卡| 国产午夜久久久久| 94-欧美-setu| 亚洲午夜国产一区99re久久| 欧美日韩的一区二区| 麻豆传媒一区二区三区| 国产亚洲欧美日韩俺去了| 成人精品视频网站| 一区二区三区在线观看欧美| 欧美男人的天堂一二区| 久草热8精品视频在线观看| 欧美激情中文字幕一区二区| 日本韩国一区二区三区视频| 亚洲6080在线| 久久综合色婷婷| jvid福利写真一区二区三区| 亚洲成人福利片| www久久精品| 99国产精品久久久久久久久久 | 麻豆成人久久精品二区三区小说| 国产婷婷色一区二区三区四区|