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

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

?? mtsrv2.pas

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

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).
Creation:     September 21, 1997
Version:      1.02
EMail:        francois.piette@pophost.eunet.be    
              francois.piette@rtfm.be             http://www.rtfm.be/fpiette
Support:      Use the mailing list twsocket@rtfm.be See website for details.
Legal issues: Copyright (C) 1997, 1998 by Fran鏾is PIETTE
              Rue de Grady 24, 4053 Embourg, Belgium. Fax: +32-4-365.74.56
              <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:

 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
unit mtsrv2;

interface

uses
  Windows, Messages, Classes, winsock, wsocket;

type
  TClientThread = class(TThread)
  private
    FClientSocket  : TWSocket;
    FClientHSocket : TSocket;
    procedure ServerWSocketDataAvailable(Sender: TObject; Error: Word);
    procedure ServerWSocketSessionClosed(Sender: TObject; Error: Word);
  protected
    procedure Execute; override;
  public
    constructor Create(ClientHSocket : TSocket);
    destructor  Destroy; override;
    procedure   Release;

    property ClientWSocket : TWSocket read FClientSocket write FClientSocket;
  end;

implementation


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ Create a new thread in the blocked state. This allow the user to register }
{ the client thread before it actually start working.                       }
constructor TClientThread.Create(ClientHSocket : TSocket);
begin
    FClientHSocket  := ClientHSocket;
    FreeOnTerminate := TRUE;
    inherited Create(TRUE);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ Destroy the thread. Destroy the ClientWSocket if needed.                  }
destructor TClientThread.Destroy;
begin
    if Assigned(FClientSocket) then begin
         FClientSocket.Destroy;
         FClientSocket := nil;
    end;
    inherited Destroy;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ This method will be called by the main server thread to terminated a      }
{ client thread.                                                            }
procedure TClientThread.Release;
begin
    PostMessage(FClientSocket.Handle, WM_QUIT, 0, 0);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ This is the main thread routine. There is not much to do because TWSocket }
{ is event driven. 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.                                  }
procedure TClientThread.Execute;
begin
    { 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                 := TWSocket.Create(nil);
    FClientSocket.HSocket         := FClientHSocket;
    FClientSocket.OnDataAvailable := ServerWSocketDataAvailable;
    FClientSocket.OnSessionClosed := ServerWSocketSessionClosed;

    { Send the welcome message                                              }
    FClientSocket.SendStr('Hello !' + #10 + #13 + '> ');

    { 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  }
    ReturnValue := 0;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ This event handler is called when the client connection is closed.        }
procedure TClientThread.ServerWSocketSessionClosed(
    Sender: TObject; Error: Word);
begin
    PostMessage(FClientSocket.Handle, WM_QUIT, 0, 0);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ 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).  }
procedure TClientThread.ServerWSocketDataAvailable(
    Sender: TObject;
    Error: Word);
var
    Buffer : array [0..4095] of char;
    Count  : Integer;
begin
    { Receive as much data as possible                                      }
    Count := FClientSocket.Receive(@Buffer, SizeOf(Buffer));

    { If data received, then process it                                     }
    if Count > 0 then begin
        if Buffer[0] = '*' then begin
            { If the first character is '*' then go to sleep a while        }
            FClientSocket.SendStr('Sleeping for 15 sec...' + #10 + #13);
            Sleep(15000);
            FClientSocket.SendStr('Wake up !' + #10 + #13);
        end
        else
            { Just echo data back to client                                 }
            FClientSocket.Send(@Buffer, Count);
    end;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
另类调教123区| 亚洲视频一二三| 美女精品一区二区| 欧美电影免费观看高清完整版在| 五月婷婷色综合| 欧美日韩在线三级| 麻豆国产一区二区| 久久久亚洲精华液精华液精华液| 国产福利一区二区三区视频在线 | 制服视频三区第一页精品| 欧洲精品中文字幕| 狂野欧美性猛交blacked| 一区二区三区四区在线免费观看| 欧美α欧美αv大片| 一本色道a无线码一区v| 国产不卡免费视频| 看电影不卡的网站| 全国精品久久少妇| 水蜜桃久久夜色精品一区的特点| 亚洲青青青在线视频| 久久久国产一区二区三区四区小说 | 51精品秘密在线观看| 成人av电影观看| 成人黄色国产精品网站大全在线免费观看 | 亚洲综合清纯丝袜自拍| 亚洲欧美色一区| 中文字幕制服丝袜一区二区三区 | 欧美一区二区三级| 精品国产一区二区精华| 国产午夜精品一区二区三区嫩草| 国产精品午夜电影| 婷婷激情综合网| 国产成人亚洲综合a∨婷婷| 一本色道久久综合精品竹菊| 91精品国产欧美一区二区18| 欧美一二三四区在线| 国产欧美日韩精品a在线观看| 中文一区二区完整视频在线观看| 中文字幕一区在线观看| 亚洲一区二区三区三| 国产在线精品免费| 处破女av一区二区| 91精品国产综合久久久久久漫画 | 欧美精品自拍偷拍| 久久久五月婷婷| 亚洲图片有声小说| 韩国中文字幕2020精品| 91视视频在线直接观看在线看网页在线看| 在线影院国内精品| 91超碰这里只有精品国产| 3d动漫精品啪啪1区2区免费| 欧美韩国日本不卡| 污片在线观看一区二区| 不卡视频一二三| 久久一夜天堂av一区二区三区| 亚洲三级理论片| 精品一区二区三区的国产在线播放| 99国产精品久| 欧美激情综合网| 美女久久久精品| 337p亚洲精品色噜噜| 亚洲免费观看高清| 波多野结衣精品在线| 精品卡一卡二卡三卡四在线| 亚洲成人免费影院| 91尤物视频在线观看| 久久九九99视频| 狠狠色丁香九九婷婷综合五月| 欧美美女bb生活片| 亚洲福利电影网| 欧美日韩成人综合| 一区二区在线观看av| voyeur盗摄精品| 国产精品久久久久久久久久久免费看| 国产一区二区三区高清播放| 精品国产免费人成在线观看| 青草国产精品久久久久久| 91精品一区二区三区久久久久久 | 捆绑紧缚一区二区三区视频| 欧美一级高清大全免费观看| 午夜精品视频一区| 91精品国产综合久久精品性色| 全部av―极品视觉盛宴亚洲| 精品久久久久99| 高清不卡在线观看| 99热在这里有精品免费| 日韩码欧中文字| 欧美日韩不卡视频| 国产精品69久久久久水密桃| 久久精品免视看| 欧美性受xxxx黑人xyx| 美女视频免费一区| 中文字幕一区二区三中文字幕| 欧美在线播放高清精品| 日本不卡高清视频| 1000精品久久久久久久久| 欧美日韩国产首页| 国产成人精品免费在线| 一区二区三区成人| 久久久精品人体av艺术| 色婷婷综合视频在线观看| 麻豆高清免费国产一区| 国产精品狼人久久影院观看方式| 在线观看91av| 一本到高清视频免费精品| 黄一区二区三区| 亚洲高清免费视频| 国产精品久久久久久久久免费桃花| 欧美另类高清zo欧美| 99久久国产免费看| 国产老肥熟一区二区三区| 婷婷中文字幕综合| 亚洲精品日产精品乱码不卡| 国产日韩欧美精品一区| 精品久久久久av影院| 6080国产精品一区二区| 欧美三级视频在线| 欧洲另类一二三四区| 色美美综合视频| 国产a精品视频| 国产精品1区2区3区| 激情综合色综合久久综合| 日韩电影在线一区| 污片在线观看一区二区| 亚洲国产成人va在线观看天堂| 亚洲婷婷综合久久一本伊一区| 亚洲国产成人在线| 国产欧美中文在线| 国产精品嫩草影院av蜜臀| 欧美国产日韩a欧美在线观看| 久久久影视传媒| 国产日韩欧美不卡| 亚洲三级在线看| 亚洲香肠在线观看| 丝袜亚洲另类欧美综合| 日韩精品电影一区亚洲| 免费在线欧美视频| 国产麻豆日韩欧美久久| 国产自产高清不卡| 成人高清在线视频| www.亚洲激情.com| 在线一区二区三区四区| 一本久久a久久精品亚洲| 欧美日韩情趣电影| 日韩精品专区在线影院重磅| 欧美国产日韩精品免费观看| 亚洲乱码国产乱码精品精98午夜| 亚洲午夜电影在线观看| 国产一区二区主播在线| 99精品国产91久久久久久 | 91免费看`日韩一区二区| 欧美性色黄大片| 久久久久久久av麻豆果冻| 亚洲免费色视频| 福利视频网站一区二区三区| 91久久久免费一区二区| 久久久久久久久久久久久久久99| 中文字幕在线观看一区二区| 日日骚欧美日韩| 欧美最猛性xxxxx直播| 国产情人综合久久777777| 日韩影院精彩在线| 97精品久久久久中文字幕| 精品国产三级a在线观看| 日韩中文字幕区一区有砖一区 | 亚洲丶国产丶欧美一区二区三区| 成人免费视频网站在线观看| 精品国产91乱码一区二区三区 | 9191国产精品| 亚洲第一综合色| 欧美日韩高清一区| 国内精品伊人久久久久av一坑 | 成人网男人的天堂| xnxx国产精品| 蜜臀久久99精品久久久久久9| 欧美一级日韩一级| 午夜国产精品影院在线观看| 欧美日本在线观看| 麻豆精品视频在线观看| 久久久99久久| 91蜜桃传媒精品久久久一区二区| 日韩美女视频一区二区| 91久久人澡人人添人人爽欧美| 亚洲一区二区三区视频在线| 欧美另类变人与禽xxxxx| 国产麻豆日韩欧美久久| 午夜久久久久久久久| 日本一区二区三区在线观看| 欧美中文字幕一二三区视频| 国产寡妇亲子伦一区二区| 天堂一区二区在线| 亚洲欧洲无码一区二区三区| 欧美精品久久久久久久久老牛影院| 成人免费观看av| 久久疯狂做爰流白浆xx| 亚洲成人免费在线| 亚洲免费观看高清在线观看| 国产欧美一区二区三区在线看蜜臀| 欧美丝袜丝交足nylons| eeuss鲁一区二区三区|