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

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

?? mtsrv2.cpp

?? 包含常用Internet協議TCP,UDP、HTTP、FTP、Telnet等
?? CPP
字號:
/*---------------------------------------------------------------------------

Author:       Fran鏾is PIETTE
Description:  This little application shows how to use the TWSocket in a
              multithreaded application. It is a very basic telnet werver.
              Each time a client connect to the server, he receive an "hello"
              message. Then every character sent is echoed back to the client.
              There are two units is this application: one for the main
              server code, and one for the client thread.
              Each time a client connect to the server, a new TWSocket is
              created and a new thread is launched to handle the client
              work. When the client disconnect, the TWSocket and the thread
              are destroyed.
              To see this demo working on your computer, start the demo then
              start several copies of the TELNET client program (the one which
              comes with Windows 95 is perfect). Then using each telnet, connect
              to 127.0.0.1. You'll see a new connection in the list box. You
              must receive the "hello" message and see each character as you
              type them. You can use the Disconnect button from the application
              or from the telnet client to see what happends (the connection
              should be closed).
EMail:        francois.piette@pophost.eunet.be.be  http://www.rtfm.be/fpiette
Creation:     September 25, 1997 (from Delphi version dated September 21, 1997)
Version:      1.00
Support:      EMail to the author
Legal issues: Copyright (C) 1997, 1998 by Fran鏾is PIETTE 
              <francois.piette@pophost.eunet.be>

              This software is provided 'as-is', without any express or
              implied warranty.  In no event will the author be held liable
              for any  damages arising from the use of this software.

              Permission is granted to anyone to use this software for any
              purpose, including commercial applications, and to alter it
              and redistribute it freely, subject to the following
              restrictions:

              1. The origin of this software must not be misrepresented,
                 you must not claim that you wrote the original software.
                 If you use this software in a product, an acknowledgment 
                 in the product documentation would be appreciated but is
                 not required.

              2. Altered source versions must be plainly marked as such, and
                 must not be misrepresented as being the original software.

              3. This notice may not be removed or altered from any source 
                 distribution.

Updates:


---------------------------------------------------------------------------*/
#include <vcl\vcl.h>
#pragma hdrstop

#include "mtsrv2.h"
//---------------------------------------------------------------------------
//   Important: Methods and properties of objects in VCL can only be
//   used in a method called using Synchronize, for example:
//
//      Synchronize(UpdateCaption);
//
//   where UpdateCaption could look like:
//
//      void __fastcall TClientThread::UpdateCaption()
//      {
//        Form1->Caption = "Updated in a thread";
//      }
//---------------------------------------------------------------------------
// Create a new thread in the blocked state. This allow the user to register
// the client thread before it actually start working.
__fastcall TClientThread::TClientThread(TSocket ClientHSocket)
    : TThread(TRUE)
{
    FClientHSocket  = ClientHSocket;
    FreeOnTerminate = TRUE;
}
//---------------------------------------------------------------------------
// Destroy the thread. Destroy the ClientWSocket if needed.
__fastcall TClientThread::~TClientThread()
{
    if (FClientSocket != NULL) {
         FClientSocket->~TWSocket();
         FClientSocket = NULL;
    }
}
//---------------------------------------------------------------------------
// This method will be called by the main server thread to terminated a
// client thread.                                                            
void __fastcall TClientThread::Release()
{
    PostMessage(FClientSocket->Handle, WM_QUIT, 0, 0);
}
//---------------------------------------------------------------------------
// This is the main thread routine. There is not much to do because TWSocket
// is event drive. So everythong to do is done inside an event handler,
// mostly the OnDataAvailable event handler which is triggered each time
// the client send something to the server.
void __fastcall TClientThread::Execute()
{
    // Create the client TWSocket. It is important to create it inside the   
    // Execute method because it *must* be created by the thread. Otherwise
    // the messages sent by winsock would be processed in the main thread
    // context, effectively disabling multi-threading.
    FClientSocket                  = new TWSocket(NULL);
    FClientSocket->HSocket         = FClientHSocket;
    FClientSocket->OnDataAvailable = ServerWSocketDataAvailable;
    FClientSocket->OnSessionClosed = ServerWSocketSessionClosed;

    // Send the welcome message
    FClientSocket->SendStr("Hello !\r\n >");

    // Message loop to handle TWSocket messages
    // The loop is exited when WM_QUIT message is received
    FClientSocket->MessageLoop();

    // Returning from the Execute function effectively terminate the thread
}
//---------------------------------------------------------------------------
// This event handler is called when the client connection is closed.
void __fastcall TClientThread::ServerWSocketSessionClosed(TObject *Sender, WORD Error)
{
    PostMessage(FClientSocket->Handle, WM_QUIT, 0, 0);
}
//---------------------------------------------------------------------------
// This event handler is called when the client has sent some data to the    
// server. It is here that we must place the client requests execution
// probably by assembling data in lines, parsing those lines for commands
// and executing the commands. Here for simplicity, we just echo back the
// data sent by the user, without doing anything serious.
// To demonstrate that blocking a thread do not block the others, when a '*'
// is received, we go to Sleep for a few seconds, effectively blocking the
// the client. But as we are multi-threaded, this do not block any other
// client.
// Do not forget to call the Synchronize method if you need to update the
// user interface. Only the main thread can do it (VCL is not thread safe).
void __fastcall TClientThread::ServerWSocketDataAvailable(TObject *Sender, WORD Error)
{
    char Buffer[4096];
    int  Count;

    // Receive as much data as possible
    Count = FClientSocket->Receive(&Buffer, sizeof(Buffer));

    // If data received, then process it
    if (Count > 0) {
        if (Buffer[0] == '*') {
            // If the first character is '*' then go to sleep a while
            FClientSocket->SendStr("Sleeping for 15 sec...\r\n");
            Sleep(15000);
            FClientSocket->SendStr("Wake up !\r\n");
        }
        else
            // Just echo data back to client
            FClientSocket->Send(&Buffer, Count);
    }
}
//---------------------------------------------------------------------------

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲最大成人网4388xx| 久久影院视频免费| 99久久精品国产麻豆演员表| 国产一区二区0| 国产成人免费在线视频| 国产91精品一区二区麻豆亚洲| 久久99日本精品| 黄网站免费久久| 成人一区在线观看| 99re热这里只有精品视频| 色综合久久久网| 欧美色精品在线视频| 7777精品伊人久久久大香线蕉经典版下载 | 日韩免费在线观看| 欧美本精品男人aⅴ天堂| 欧美本精品男人aⅴ天堂| 国产日韩精品久久久| 亚洲天堂a在线| 亚洲成人动漫在线免费观看| 美女诱惑一区二区| 国产成人a级片| 欧美在线影院一区二区| 欧美一区二区成人6969| 久久久不卡网国产精品一区| 国产精品麻豆网站| 天天操天天综合网| 国产成人av电影在线| 色综合中文字幕国产| 欧美性淫爽ww久久久久无| 欧美一区二区视频在线观看2020| 精品国产91洋老外米糕| 亚洲天堂福利av| 久久99精品久久只有精品| av成人动漫在线观看| 欧美一区二区视频观看视频| 国产精品嫩草久久久久| 亚洲地区一二三色| 成人激情免费电影网址| 欧美日本在线播放| 欧美国产97人人爽人人喊| 亚洲h在线观看| 成人网页在线观看| 在线播放/欧美激情| 国产精品入口麻豆原神| 日本系列欧美系列| 91福利精品第一导航| 久久影视一区二区| 日韩电影在线一区| 色猫猫国产区一区二在线视频| 欧美成人aa大片| 午夜精品久久久久| 色综合欧美在线视频区| 国产日韩综合av| 精品一区二区在线视频| 91精品国产综合久久蜜臀| 日韩理论电影院| 国产成人日日夜夜| 日韩三级伦理片妻子的秘密按摩| 一区二区三区.www| 91在线视频观看| 欧美激情一区三区| 国产成人在线视频网站| 日韩精品一区二区三区中文精品| 亚欧色一区w666天堂| 色婷婷综合久久久久中文| 中文av一区特黄| www.视频一区| 中文字幕一区二区三区在线不卡| 九色|91porny| 久久久久久久久久久电影| 毛片av中文字幕一区二区| 91麻豆精品国产| 天天综合网天天综合色| 欧美精品一卡二卡| 日韩精品国产精品| 欧美一区二区三区视频在线观看| 视频精品一区二区| 欧美日韩电影在线| 蜜臀91精品一区二区三区 | 另类小说欧美激情| 欧美一级欧美三级| 黄页视频在线91| 亚洲国产精华液网站w| 成人午夜激情片| 国产精品国产馆在线真实露脸| 粉嫩av一区二区三区在线播放 | 麻豆中文一区二区| 亚洲精品一区二区三区福利| 国产综合色产在线精品| 国产精品免费网站在线观看| 色综合久久中文综合久久牛| 亚洲午夜国产一区99re久久| 欧美精品tushy高清| 久久99国产精品麻豆| 亚洲国产高清aⅴ视频| 色婷婷综合久色| 日本在线播放一区二区三区| 精品成人在线观看| 99久久伊人网影院| 午夜私人影院久久久久| xfplay精品久久| 色美美综合视频| 激情综合色播激情啊| 国产精品久久久久影院色老大| 色先锋资源久久综合| 美女网站在线免费欧美精品| 国产精品免费丝袜| 日韩色在线观看| 99在线精品观看| 美女一区二区三区在线观看| 日韩一区在线看| 日韩一区二区不卡| 色婷婷综合久久久| 国产精选一区二区三区| 亚洲国产视频a| 国产日韩欧美不卡在线| 欧美日韩国产乱码电影| 成+人+亚洲+综合天堂| 蜜乳av一区二区三区| 亚洲人成人一区二区在线观看 | 欧美日本精品一区二区三区| 裸体健美xxxx欧美裸体表演| 国产精品美日韩| 日韩午夜激情av| 欧美性一级生活| 99精品国产热久久91蜜凸| 九色综合狠狠综合久久| 亚洲成人自拍一区| 亚洲精品国产无天堂网2021| 久久久天堂av| 精品国产1区2区3区| 欧美男女性生活在线直播观看| 不卡欧美aaaaa| 国产一本一道久久香蕉| 日本成人在线视频网站| 午夜精品免费在线观看| 亚洲欧美日韩中文播放| 国产女同性恋一区二区| 26uuu精品一区二区| 91精品国产91久久久久久最新毛片| 91老师片黄在线观看| 成人高清免费观看| 国产99久久久国产精品| 国产呦精品一区二区三区网站| 午夜亚洲国产au精品一区二区| 一区二区在线观看视频| 亚洲欧美日韩电影| 亚洲丝袜制服诱惑| 中文字幕欧美一区| 亚洲另类在线制服丝袜| 亚洲激情av在线| 午夜视频在线观看一区二区三区 | 精品99一区二区三区| 欧美成人女星排名| 精品动漫一区二区三区在线观看| 日韩一区二区三区在线| 精品少妇一区二区三区在线播放 | 97精品国产露脸对白| 成人av网站在线| jizzjizzjizz欧美| 色综合 综合色| 欧美日韩中文国产| 91麻豆精品国产91久久久使用方法 | 亚洲一区二区五区| 午夜在线成人av| 美腿丝袜亚洲三区| 国产一区二区久久| 成人小视频在线| 91精品办公室少妇高潮对白| 色婷婷av一区二区三区大白胸| 色婷婷av一区二区三区gif| 欧美日韩精品一区视频| 91精品国产综合久久久蜜臀粉嫩 | 在线视频一区二区三| 在线成人av影院| 欧美精品一区视频| 日韩美女精品在线| 午夜视频在线观看一区二区 | 国产精品99久久久久久宅男| www.日韩av| 日韩色在线观看| 1区2区3区精品视频| 日韩福利视频导航| 成人综合婷婷国产精品久久| 91蜜桃在线免费视频| 制服丝袜亚洲网站| 国产精品高潮呻吟| 日韩激情一区二区| 99麻豆久久久国产精品免费| 欧美日韩精品综合在线| 国产欧美1区2区3区| 天天做天天摸天天爽国产一区 | 99re亚洲国产精品| 日韩精品一区二区三区视频播放 | 欧美一区二区视频网站| 综合色天天鬼久久鬼色| 久久99精品久久久久久久久久久久 | 2020国产精品自拍| 一二三四区精品视频| 国产高清亚洲一区|