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

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

?? icsdll1.dpr

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

Author:       Fran鏾is PIETTE
Creation:     April 03, 2000
Description:  This is a demo showing how to use a TWSocket component in a DLL.
              This demo must be used with ICS TcpSrv demo program as a server.
              The DLL is a client which connect to the server and send "time"
              command, then wait for the reply and return it in the buffer
              passed to the DLL.
              There is only one function exported from the DLL: IcsDllDemo.
              It takes four arguments: a pointer to the hostname to connect to,
              a pointer to the port, a pointer to a buffer and a pointer for
              buffer size. On entry buffer size must be initialised with the
              size of the actual buffer. On exit, it is filled with the
              actual reply size. The function's return value is the error code
              such as 10061 when the server is not running.
Version:      1.01
EMail:        francois.piette@pophost.eunet.be    francois.piette@swing.be
              francois.piette@rtfm.be             http://www.rtfm.be/fpiette
Support:      Unsupported code.
Legal issues: Copyright (C) 2000 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.

              4. You must register this software by sending a picture postcard
                 to the author. Use a nice stamp and mention your name, street
                 address, EMail address and any comment you like to say.

History:
Apr 29, 2000 V1.01 Use WSocketForceLoadWinsock.


 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
library IcsDll1;

{$DEFINE NOFORMS}   // This will avoid forms unit and reduce DLL size

uses
  Windows, Messages, SysUtils, Classes, WSocket;

function IcsDllDemo(HostName : PChar;
                    Port     : PChar;
                    Buffer   : PChar;
                    BufSize  : PInteger): Integer; stdcall; forward;
procedure StrToBuffer(Buffer : PChar; BufSize : PInteger; Msg : String); forward;

exports
    IcsDllDemo;

type
  // We use a workerthread to do the job.
  // This will allows the DLL to be called by several processes simultaneously
  TClientThread = class(TThread)
  private
    FClientSocket   : TWSocket;
    FBannerReceived : Boolean;
    FErrorCode      : PInteger;
    FBuffer         : PChar;
    FBufSize        : PInteger;
    FHostName       : PChar;
    FPort           : PChar;
    procedure ClientWSocketDataAvailable(Sender: TObject; Error: Word);
    procedure ClientWSocketSessionConnected(Sender: TObject; Error: Word);
    procedure ClientWSocketSessionClosed(Sender: TObject; Error: Word);
  protected
    procedure Execute; override;
  public
    constructor Create;
    destructor  Destroy; override;

    property ClientWSocket : TWSocket read FClientSocket write FClientSocket;
    property Buffer        : PChar    read FBuffer       write FBuffer;
    property BufSize       : PInteger read FBufSize      write FBufSize;
    property ErrorCode     : PInteger read FErrorCode    write FErrorCode;
    property HostName      : PChar    read FHostName     write FHostName;
    property Port          : PChar    read FPort         write FPort;
  end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ 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;
begin
    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 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     }
{ something is received.						    }
procedure TClientThread.Execute;
begin
    try
        { 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.OnDataAvailable    := ClientWSocketDataAvailable;
        FClientSocket.OnSessionConnected := ClientWSocketSessionConnected;
        FClientSocket.OnSessionClosed    := ClientWSocketSessionClosed;
        FClientSocket.LineMode           := TRUE;
        FClientSocket.Addr               := FHostName;
        FClientSocket.Port               := FPort;
        FClientSocket.Proto              := 'tcp';
        FClientSocket.Connect;

        { Message loop to handle TWSocket messages                          }
        { The loop is exited when WM_QUIT message is received               }
        FClientSocket.MessageLoop;
    except
        on E:Exception do begin
            FErrorCode^ := -3;
            StrToBuffer(Buffer, BufSize, E.ClassName + ':' + E.Message);
        end;
    end;

    { Returning from the Execute function effectively terminate the thread  }
    ReturnValue := 0;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ This event handler is called when the client connection is established.   }
procedure TClientThread.ClientWSocketSessionConnected(
    Sender: TObject; Error: Word);
begin
    if Error <> 0 then begin
        FErrorCode^ := Error;
        StrToBuffer(Buffer, BufSize, 'Connect failed');
        PostMessage(FClientSocket.Handle, WM_QUIT, 0, 0);
        Exit;
    end;
end;


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


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ This event handler is called when data has been received from server.     }
{ Since this sample program use line mode, we comes here only when a        }
{ complete line has been received.                                          }
procedure TClientThread.ClientWSocketDataAvailable(
    Sender: TObject;
    Error: Word);
var
    RcvBuffer : String;
begin
    // Received the line
    RcvBuffer := FClientSocket.ReceiveStr;
    // Check if we already received the banner (message sent by server
    // as soon as we are connected.
    if not FBannerReceived then begin
        // We are just receiving the banner. Flag as received
        FBannerReceived := TRUE;
        // Then send the command to the server
        FClientSocket.SendStr('time' + #13 + #10);
    end
    else begin
        // We already received then banner. So this must be the answer
        // to our command. Copy to the buffer, without trailling CR/LF
        // and without overflowing the given buffer
        if Length(RcvBuffer) < BufSize^ then
            BufSize^ := Length(RcvBuffer) - 2;  // Remove CR/LF
        if BufSize^ > 0 then
            Move(RcvBuffer[1], Buffer^, BufSize^);
        // Then just close the communication
        FClientSocket.CloseDelayed;
        FErrorCode^ := 0;
    end;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ Copy a string to a buffer with overflow check.                            }
procedure StrToBuffer(Buffer : PChar; BufSize : PInteger; Msg : String);
begin
    if Length(Msg) < BufSize^ then
        BufSize^ := Length(Msg);
    if BufSize^ > 0 then
        Move(Msg[1], Buffer^, BufSize^);
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function IcsDllDemo(
    HostName : PChar;
    Port     : PChar;
    Buffer   : PChar;
    BufSize  : PInteger): integer; stdcall;
var
    WorkerThread : TClientThread;
begin
    try
        Result := -1;
        // Create a new thread. It is created in sleeping state
        WorkerThread           := TClientThread.Create;
        // Then pass all parameters
        WorkerThread.Buffer    := Buffer;
        WorkerThread.BufSize   := BufSize;
        WorkerThread.ErrorCode := @Result;
        WorkerThread.HostName  := HostName;
        WorkerThread.Port      := Port;
        // Then let thread start his work
        WorkerThread.Resume;
        // And wait until it finishes
        WaitForSingleObject(WorkerThread.Handle, INFINITE);
    except
        on E:Exception do begin
            Result := -2;
            StrToBuffer(Buffer, BufSize, E.ClassName + ': ' + E.Message);
        end;
    end;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure DLLHandler(Reason: Integer);
begin
    if Reason = DLL_PROCESS_DETACH then begin
//      MessageBox(0, PChar('Reason = ' + IntToStr(Reason)), 'DLLHandler', MB_OK);
        WSocketCancelForceLoadWinsock;
    end;
end;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
begin
//  MessageBox(0, PChar('DLL Init ' + IntToStr(WSocketGCount)), 'DLL', MB_OK);
    WSocketForceLoadWinsock;
    DLLProc := @DLLHandler;
end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美蜜桃一区二区三区| 日韩欧美视频一区| 国产原创一区二区| 亚洲久草在线视频| 欧美zozozo| 欧美日韩一本到| 成人免费看片app下载| 丝袜美腿亚洲综合| 亚洲精品国产无套在线观| 久久一夜天堂av一区二区三区| 91黄色激情网站| 懂色av一区二区夜夜嗨| 日韩av电影天堂| 亚洲激情图片qvod| 国产精品乱人伦| 精品精品国产高清一毛片一天堂| 在线观看国产91| 99精品在线免费| 高清成人免费视频| 国产精品一二三四| 蜜桃视频在线一区| 日韩高清电影一区| 视频一区在线播放| 亚洲韩国一区二区三区| 国产精品超碰97尤物18| 国产亚洲成年网址在线观看| 日韩视频免费观看高清在线视频| 欧美日韩大陆在线| 欧美日韩情趣电影| 欧美人与z0zoxxxx视频| 欧美性受xxxx黑人xyx性爽| 色一区在线观看| 99久久精品国产观看| 9色porny自拍视频一区二区| 国产黄人亚洲片| 国产精品1区二区.| 国产裸体歌舞团一区二区| 麻豆精品一区二区三区| 老司机午夜精品99久久| 麻豆精品在线看| 另类人妖一区二区av| 麻豆91在线观看| 国产又黄又大久久| 国产成人精品在线看| 成人网在线免费视频| 粉嫩在线一区二区三区视频| 丁香网亚洲国际| av电影在线观看一区| 91影视在线播放| 欧美性大战xxxxx久久久| 在线观看欧美精品| 3751色影院一区二区三区| 91精品国产综合久久久久久久| 在线91免费看| 欧美一区二区黄| 日韩欧美亚洲国产另类 | 色一情一伦一子一伦一区| 成人国产精品免费观看动漫| 91美女视频网站| 欧美高清性hdvideosex| 日韩视频国产视频| 国产日韩v精品一区二区| 国产精品久久久久久久蜜臀| 亚洲精品免费电影| 日韩高清不卡一区| 韩国理伦片一区二区三区在线播放| 国产毛片精品视频| 91网站视频在线观看| 欧美视频精品在线观看| 日韩精品最新网址| 国产精品伦一区二区三级视频| 亚洲另类在线制服丝袜| 偷拍日韩校园综合在线| 国产一区 二区| 色综合天天综合色综合av| 欧美日韩国产大片| 亚洲国产精品ⅴa在线观看| 一区二区三区欧美在线观看| 看片的网站亚洲| 成人黄色国产精品网站大全在线免费观看 | 天堂va蜜桃一区二区三区漫画版| 另类欧美日韩国产在线| 成人av在线一区二区| 这里只有精品视频在线观看| 久久精品一区八戒影视| 亚洲一区二区三区中文字幕在线| 蜜桃av一区二区| 99国产欧美另类久久久精品| 欧美一卡二卡在线| 亚洲图片激情小说| 久久99国产精品久久99果冻传媒| 成+人+亚洲+综合天堂| 91麻豆精品国产无毒不卡在线观看| 国产午夜精品美女毛片视频| 亚洲一二三区不卡| 不卡的电影网站| 精品国产精品网麻豆系列| 一区二区高清在线| 国产a精品视频| 日韩欧美第一区| 夜夜精品视频一区二区| 风流少妇一区二区| 精品国产电影一区二区| 亚洲成人免费视频| 99国产一区二区三精品乱码| ww亚洲ww在线观看国产| 婷婷开心激情综合| 色噜噜狠狠成人网p站| 国产精品素人视频| 国模冰冰炮一区二区| 欧美日韩在线播放三区四区| 成人免费在线视频观看| 国产一区二区伦理片| 制服丝袜成人动漫| 亚洲精品视频免费看| bt欧美亚洲午夜电影天堂| 欧美精品一区二区高清在线观看 | 欧美一区二区视频在线观看2022 | 在线免费观看不卡av| 欧美国产一区视频在线观看| 久久se这里有精品| 26uuu亚洲| 青青草一区二区三区| 欧美日韩日日摸| 亚洲一区二区在线播放相泽| 91视频免费播放| 国产精品色哟哟| 国产一区二区三区视频在线播放| 欧美大片免费久久精品三p| 青青草国产成人av片免费| 欧美一区欧美二区| 视频一区二区国产| 在线不卡免费欧美| 亚洲成人免费在线| 欧美日韩久久一区二区| 亚洲福利电影网| 欧美日韩一区二区三区不卡| 香蕉成人啪国产精品视频综合网| 欧美亚洲图片小说| 日韩综合小视频| 3751色影院一区二区三区| 男人的j进女人的j一区| 日韩写真欧美这视频| 韩国女主播一区二区三区| 久久人人超碰精品| 国产精品99久久久| 亚洲国产成人自拍| 成人av在线资源网| 亚洲综合丝袜美腿| 欧美一区二区三区不卡| 久久66热偷产精品| 久久久久9999亚洲精品| 风间由美性色一区二区三区| 成人欧美一区二区三区| 欧美日韩一区二区三区在线看| 性感美女久久精品| 日韩精品专区在线| 丁香网亚洲国际| 亚洲一本大道在线| 欧美videossexotv100| 丰满亚洲少妇av| 亚洲一区二区视频在线观看| 欧美一区二区三区思思人| 国产精品资源网| 亚洲色图欧美偷拍| 91精品国产91综合久久蜜臀| 国产在线麻豆精品观看| 自拍偷拍国产亚洲| 91精品国产91综合久久蜜臀| 国产91露脸合集magnet| 亚洲一区在线视频观看| 精品国产免费人成在线观看| 成人avav在线| 青草av.久久免费一区| 国产女主播一区| 欧美日韩色综合| 国产精品69毛片高清亚洲| 伊人色综合久久天天人手人婷| 欧美成人伊人久久综合网| 成人免费观看视频| 日本成人超碰在线观看| 亚洲国产精华液网站w| 欧美精品电影在线播放| 国产一区二区剧情av在线| 亚洲国产一二三| 久久久久久久久久美女| 欧美专区亚洲专区| 国产成人av在线影院| 日本网站在线观看一区二区三区 | xfplay精品久久| 欧美色手机在线观看| 国产成人啪午夜精品网站男同| 亚洲电影一级黄| 国产精品你懂的在线| 欧美一区二区三区婷婷月色| 色综合天天视频在线观看| 国产一区二区女| 青青草国产精品亚洲专区无| 亚洲综合男人的天堂| 国产精品久久久久天堂|