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

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

?? idhl7.pas

?? delphi indy9.0.18組件包
?? PAS
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
{ $HDR$}
{**********************************************************************}
{ Unit archived using Team Coherence                                   }
{ Team Coherence is Copyright 2002 by Quality Software Components      }
{                                                                      }
{ For further information / comments, visit our WEB site at            }
{ http://www.TeamCoherence.com                                         }
{**********************************************************************}
{}
{ $Log:  10187: IdHL7.pas 
{
{   Rev 1.3    30/6/2003 15:07:54  GGrieve
{ Remove kdeVersionMark (legacy internal code it Kestral)
}
{
{   Rev 1.2    20/6/2003 11:16:36  GGrieve
{ fix compile problem
}
{
{   Rev 1.1    20/6/2003 08:59:28  GGrieve
{ connection in events, and fix problem with singleThread mode
}
{
  Indy HL7 Minimal Lower Layer Protocol TIdHL7

    Original author Grahame Grieve

    This code was donated by HL7Connect.com
    For more HL7 open source code see
    http://www.hl7connect.com/tools

  This unit implements support for the Standard HL7 minimal Lower Layer
  protocol. For further details, consult the HL7 standard (www.hl7.org).

  Before you can use this component, you must set the following properties:
    CommunicationMode
    Address (if you want to be a client)
    Port
    isListener
  and hook the appropriate events (see below)

  This component will operate as either a server or a client depending on
  the configuration
}

{
 Version History:
   20/06/2003   Grahame Grieve      Add Connection to events. (break existing code, sorry)
   05/09/2002   Grahame Grieve      Fixed SingleThread Timeout Issues + WaitForConnection
   23/01/2002   Grahame Grieve      Fixed for network changes to TIdTCPxxx
                                    wrote DUnit testing,
                                    increased assertions
                                    change OnMessageReceive - added VHandled parameter
   07/12/2001   Grahame Grieve      Various fixes for cmSingleThread mode
   05/11/2001   Grahame Grieve      Merge into Indy
   03/09/2001   Grahame Grieve      Prepare for Indy
}

(* note: Events are structurally important for this component. However there is
  a bug in SyncObjs for Linux under Kylix 1 and 2 where TEvent.WaitFor cannot be
  used with timeouts. If you compile your own RTL, then you can fix the routine
  like this:

    function TEvent.WaitFor(Timeout: LongWord): TWaitResult;
    {$IFDEF LINUX}
    var ts : TTimeSpec;
    begin
      ts.tv_sec  := timeout div 1000;
      ts.tv_nsec := (timeout mod 1000) * 1000000;
      if sem_timedwait(FSem, ts) = 0 then
        result := wrSignaled
      else
        result := wrTimeOut;
    {$ENDIF}

  and then disable this define: *)

  { this is a serious issue - unless you fix the RTL, this component does not
    function properly on Linux at the present time. This may be fixed in a
    future version }

unit IdHL7;

interface

uses
  Classes,
  IdBaseComponent,
  IdException,
  IdGlobal,
  IdTCPClient,
  IdTCPConnection,
  IdTCPServer,
  SyncObjs,
  SysUtils;

const
  MSG_START = #$0B;       {do not localize}
  MSG_END = #$1C#$0D;   {do not localize}

  BUFFER_SIZE_LIMIT = 1024 * 1024;  // buffer is allowed to grow to this size without any
  // valid messages. Will be truncated with no notice (DoS protection)

  WAIT_STOP = 5000; // nhow long we wait for things to shut down cleanly

type
  EHL7CommunicationError = class(EIdException)
  Protected
    FInterfaceName: String;
  Public
    constructor Create(AnInterfaceName, AMessage: String);
    property InterfaceName: String Read FInterfaceName;
  end;


  THL7CommunicationMode = (cmUnknown,        // not valid - default setting must be changed by application
    cmAsynchronous,   // see comments below for meanings of the other parameters
    cmSynchronous,
    cmSingleThread);

  TSendResponse = (srNone,          // internal use only - never returned
    srError,         // internal use only - never returned
    srNoConnection,  // you tried to send but there was no connection
    srSent,          // you asked to send without waiting, and it has been done
    srOK,            // sent ok, and response returned
    srTimeout);      // we sent but there was no response (connection will be dropped internally

  TIdHL7Status = (isStopped,       // not doing anything
    isNotConnected,  // not Connected (Server state)
    isConnecting,    // Client is attempting to connect
    isWaitReconnect, // Client is in delay loop prior to attempting to connect
    isConnected,     // connected OK
    isUnusable       // Not Usable - stop failed
    );

const
  { default property values }
  DEFAULT_ADDRESS = '';         {do not localize}
  DEFAULT_PORT = 0;
  DEFAULT_TIMEOUT = 30000;
  DEFAULT_RECEIVE_TIMEOUT = 30000;
  NULL_IP = '0.0.0.0';  {do not localize}
  DEFAULT_CONN_LIMIT = 1;
  DEFAULT_RECONNECT_DELAY = 15000;
  DEFAULT_COMM_MODE = cmUnknown;
  DEFAULT_IS_LISTENER = True;
  MILLISECOND_LENGTH = (1 / (24 * 60 * 60 * 1000));

type
  // the connection is provided in these events so that applications can obtain information about the
  // the peer. It's never OK to write to these connections
  TMessageArriveEvent = procedure(ASender: TObject; AConnection: TIdTCPConnection; AMsg: String) of object;
  TMessageReceiveEvent = procedure(ASender: TObject; AConnection: TIdTCPConnection; AMsg: String; var VHandled: Boolean; var VReply: String) of object;
  TReceiveErrorEvent = procedure(ASender: TObject; AConnection: TIdTCPConnection; AMsg: String; AException: Exception; var VReply: String; var VDropConnection: Boolean) of object;

  TIdHL7 = class;
  TIdHL7ConnCountEvent = procedure(ASender: TIdHL7; AConnCount: Integer) of object;

  TIdHL7PeerThread = class(TIdPeerThread)
  Protected
    FBuffer: String;
  Public
    constructor Create(ACreateSuspended: Boolean = True); Override;
    destructor Destroy; Override;
  end;

  TIdHL7ClientThread = class(TThread)
  Protected
    FClient: TIdTCPClient;
    FCloseEvent: TIdLocalEvent;
    FOwner: TIdHL7;
    procedure Execute; Override;
    procedure PollStack;
  Public
    constructor Create(aOwner: TIdHL7);
    destructor Destroy; Override;
  end;

  TIdHL7 = class(TIdBaseComponent)
  Protected
    FLock: TCriticalSection;
    FStatus: TIdHL7Status;
    FStatusDesc: String;

    // these queues hold messages when running in singlethread mode
    FMsgQueue: TList;
    FHndMsgQueue: TList;

    FAddress: String;
    FCommunicationMode: THL7CommunicationMode;
    FConnectionLimit: Word;
    FIPMask: String;
    FIPRestriction: String;
    FIsListener: Boolean;
    FObject: TObject;
    FPreStopped: Boolean;
    FPort: Word;
    FReconnectDelay: Cardinal;
    FTimeOut: Cardinal;
    FReceiveTimeout: Cardinal;


    FOnConnect: TNotifyEvent;
    FOnDisconnect: TNotifyEvent;
    FOnConnCountChange: TIdHL7ConnCountEvent;
    FOnMessageArrive: TMessageArriveEvent;
    FOnReceiveMessage: TMessageReceiveEvent;
    FOnReceiveError: TReceiveErrorEvent;

    FIsServer: Boolean;
    // current connection count (server only) (can only exceed 1 when mode is not
    // asynchronous and we are listening)
    FConnCount: Integer;
    FServer: TIdTCPServer;
    // if we are a server, and the mode is not asynchronous, and we are not listening, then
    // we will track the current server connection with this, so we can initiate sending on it
    FServerConn: TIdTCPServerConnection;

    // A thread exists to connect and receive incoming tcp traffic
    FClientThread: TIdHL7ClientThread;
    FClient: TIdTCPClient;

    // these fields are used for handling message response in synchronous mode
    FWaitingForAnswer: Boolean;
    FWaitStop: TDatetime;
    FMsgReply: String;
    FReplyResponse: TSendResponse;
    FWaitEvent: TIdLocalEvent;

    procedure SetAddress(const AValue: String);
    procedure SetConnectionLimit(const AValue: Word);
    procedure SetIPMask(const AValue: String);
    procedure SetIPRestriction(const AValue: String);
    procedure SetPort(const AValue: Word);
    procedure SetReconnectDelay(const AValue: Cardinal);
    procedure SetTimeOut(const AValue: Cardinal);
    procedure SetCommunicationMode(const AValue: THL7CommunicationMode);
    procedure SetIsListener(const AValue: Boolean);
    function GetStatus: TIdHL7Status;
    function GetStatusDesc: String;

    procedure InternalSetStatus(const AStatus: TIdHL7Status; ADesc: String);

    procedure CheckServerParameters;
    procedure StartServer;
    procedure StopServer;
    procedure DropServerConnection;
    procedure ServerConnect(AThread: TIdPeerThread);
    procedure ServerExecute(AThread: TIdPeerThread);
    procedure ServerDisconnect(AThread: TIdPeerThread);

    procedure CheckClientParameters;
    procedure StartClient;
    procedure StopClient;
    procedure DropClientConnection;

    procedure HandleIncoming(var VBuffer: String; AConnection: TIdTCPConnection);
    function HandleMessage(const AMsg: String; AConn: TIdTCPConnection; var VReply: String): Boolean;
  Public
    constructor Create(Component: TComponent); Override;
    destructor Destroy; Override;

    procedure EnforceWaitReplyTimeout;

    function Going: Boolean;

    // for the app to use to hold any related object
    property ObjTag: TObject Read FObject Write FObject;

    // status
    property Status: TIdHL7Status Read GetStatus;
    property StatusDesc: String Read GetStatusDesc;
    function Connected: Boolean;

    property IsServer: Boolean Read FIsServer;
    procedure Start;
    procedure PreStop; // call this in advance to start the shut down process. You do not need to call this
    procedure Stop;

    procedure WaitForConnection(AMaxLength: Integer); // milliseconds

    // asynchronous.
    function AsynchronousSend(AMsg: String): TSendResponse;
    property OnMessageArrive: TMessageArriveEvent Read FOnMessageArrive Write FOnMessageArrive;

    // synchronous
    function SynchronousSend(AMsg: String; var VReply: String): TSendResponse;
    property OnReceiveMessage: TMessageReceiveEvent Read FOnReceiveMessage Write FOnReceiveMessage;
    procedure CheckSynchronousSendResult(AResult: TSendResponse; AMsg: String);

    // single thread
    procedure SendMessage(AMsg: String);
    // you can't call SendMessage again without calling GetReply first
    function GetReply(var VReply: String): TSendResponse;
    function GetMessage(var VMsg: String): pointer;  // return nil if no messages
    // if you don't call SendReply then no reply will be sent.
    procedure SendReply(AMsgHnd: pointer; AReply: String);

  Published
    // basic properties
    property Address: String Read FAddress Write SetAddress;  // leave blank and we will be server
    property Port: Word Read FPort Write SetPort Default DEFAULT_PORT;

    // milliseconds - message timeout - how long we wait for other system to reply
    property TimeOut: Cardinal Read FTimeOut Write SetTimeOut Default DEFAULT_TIMEOUT;

    // milliseconds - message timeout. When running cmSingleThread, how long we wait for the application to process an incoming message before giving up
    property ReceiveTimeout: Cardinal Read FReceiveTimeout Write FReceiveTimeout Default DEFAULT_RECEIVE_TIMEOUT;

    // server properties
    property ConnectionLimit: Word Read FConnectionLimit Write SetConnectionLimit Default DEFAULT_CONN_LIMIT; // ignored if isListener is false
    property IPRestriction: String Read FIPRestriction Write SetIPRestriction;
    property IPMask: String Read FIPMask Write SetIPMask;

    // client properties

    // milliseconds - how long we wait after losing connection to retry
    property ReconnectDelay: Cardinal Read FReconnectDelay Write SetReconnectDelay Default DEFAULT_RECONNECT_DELAY;

    // message flow

    // Set this to one of 4 possibilities:
    //
    //    cmUnknown
    //       Default at start up. You must set a value before starting
    //
    //    cmAsynchronous
    //        Send Messages with AsynchronousSend. does not wait for
    //                   remote side to respond before returning
    //        Receive Messages with OnMessageArrive. Message may
    //                   be response or new message
    //       The application is responsible for responding to the remote
    //       application and dropping the link as required
    //       You must hook the OnMessageArrive Event before setting this mode
    //       The property IsListener has no meaning in this mode
    //
    //   cmSynchronous
    //       Send Messages with SynchronousSend. Remote applications response
    //                   will be returned (or timeout). Only use if IsListener is false
    //       Receive Messages with OnReceiveMessage. Only if IsListener is
    //                   true
    //       In this mode, the object will wait for a response when sending,
    //       and expects the application to reply when a message arrives.
    //       In this mode, the interface can either be the listener or the
    //       initiator but not both. IsListener controls which one.
    //       note that OnReceiveMessage must be thread safe if you allow
    //       more than one connection to a server
    //
    //   cmSingleThread
    //       Send Messages with SendMessage. Poll for answer using GetReply.
    //                   Only if isListener is false
    //       Receive Messages using GetMessage. Return a response using
    //                   SendReply. Only if IsListener is true
    //       This mode is the same as cmSynchronous, but the application is
    //       assumed to be single threaded. The application must poll to
    //       find out what is happening rather than being informed using
    //       an event in a different thread

    property CommunicationMode: THL7CommunicationMode Read FCommunicationMode Write SetCommunicationMode Default DEFAULT_COMM_MODE;

    // note that IsListener is not related to which end is client. Either end
    // may make the connection, and thereafter only one end will be the initiator
    // and one end will be the listener. Generally it is recommended that the
    // listener be the server. If the client is listening, network conditions
    // may lead to a state where the client has a phantom connection and it will
    // never find out since it doesn't initiate traffic. In this case, restart
    // the interface if there isn't traffic for a period
    property IsListener: Boolean Read FIsListener Write SetIsListener Default DEFAULT_IS_LISTENER;

    // useful for application
    property OnConnect: TNotifyEvent Read FOnConnect Write FOnConnect;
    property OnDisconnect: TNotifyEvent Read FOnDisconnect Write FOnDisconnect;
    // this is called whenever OnConnect and OnDisconnect are called, and at other times, but only when server
    // it will be called after OnConnect and before OnDisconnect
    property OnConnCountChange: TIdHL7ConnCountEvent Read FOnConnCountChange Write FOnConnCountChange;

    // this is called when an unhandled exception is generated by the
    // hl7 object or the application. It allows the application to
    // construct a useful return error, log the exception, and drop the
    // connection if it wants
    property OnReceiveError: TReceiveErrorEvent Read FOnReceiveError Write FOnReceiveError;
  end;

implementation

uses
  IdResourceStrings;

type
  TQueuedMessage = class(TInterfacedObject)
  Private
    FEvent: TIdLocalEvent;
    FMsg: String;
    FTimeOut: Cardinal;
    FReply: String;
    procedure Wait;
  Public
    constructor Create(aMsg: String; ATimeOut: Cardinal);
    destructor Destroy; Override;
    function _AddRef: Integer; Stdcall;
    function _Release: Integer; Stdcall;
  end;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合网站在线| 91视频观看视频| 亚洲欧美乱综合| 欧美一区二区三区在线观看视频| 国产一区二区三区四区在线观看| 一区二区三区中文免费| 精品少妇一区二区三区在线播放| 色狠狠色狠狠综合| 国产精品18久久久久久久久 | 国产不卡在线视频| 亚洲一区二区欧美日韩| 国产欧美日韩在线| 欧美一级免费大片| 欧美综合久久久| eeuss国产一区二区三区| 久久成人精品无人区| 亚洲大片精品永久免费| 成人免费在线观看入口| 久久久久亚洲蜜桃| 日韩欧美综合在线| 欧美日韩不卡视频| 色噜噜狠狠成人中文综合| 高清不卡一区二区| 国产精品亚洲人在线观看| 日韩va亚洲va欧美va久久| 亚洲精品水蜜桃| 中文字幕在线不卡一区| 久久久不卡网国产精品二区 | 欧美视频在线观看一区| 91影视在线播放| 床上的激情91.| 国产麻豆精品在线观看| 黄色日韩三级电影| 精品一区二区国语对白| 裸体健美xxxx欧美裸体表演| 偷拍自拍另类欧美| 午夜精品久久久久久久| 亚洲国产另类av| 亚洲高清免费视频| 视频在线在亚洲| 日本网站在线观看一区二区三区| 天堂成人国产精品一区| 日韩在线卡一卡二| 蜜臀久久99精品久久久画质超高清 | 欧美三级中文字幕| 在线观看日产精品| 欧美日韩国产影片| 69av一区二区三区| 日韩你懂的在线播放| 精品福利二区三区| 欧美极品xxx| 日韩一区欧美小说| 亚洲最色的网站| 天天免费综合色| 麻豆精品久久久| 国产高清不卡一区| 91亚洲精品久久久蜜桃| 欧美日韩免费观看一区三区| 欧美一区二区久久| 久久综合九色综合97_久久久| 国产亚洲美州欧州综合国| 中文一区在线播放| 一区二区三区在线看| 日本中文字幕一区二区视频 | 欧美精品一区二区三区高清aⅴ| 2017欧美狠狠色| 国产精品护士白丝一区av| 亚洲综合激情小说| 久久99国产精品免费| 成人黄色在线看| 欧美日韩精品高清| 久久亚洲综合色一区二区三区| 国产精品女人毛片| 午夜不卡在线视频| 国产激情一区二区三区桃花岛亚洲| eeuss鲁片一区二区三区| 欧美日韩高清一区二区三区| 久久久亚洲欧洲日产国码αv| 亚洲天堂av老司机| 奇米精品一区二区三区在线观看 | 亚洲国产一区二区在线播放| 久久99久久99| 91丝袜美腿高跟国产极品老师| 4438亚洲最大| 国产精品传媒入口麻豆| 日韩不卡一区二区| 99麻豆久久久国产精品免费优播| 欧美高清视频www夜色资源网| 久久综合九色综合97婷婷女人 | 日韩中文字幕区一区有砖一区 | 日韩精品一区二区三区四区| 中文字幕日韩精品一区 | 奇米在线7777在线精品| 99麻豆久久久国产精品免费优播| 欧美一区二区高清| 亚洲另类在线视频| 国产福利一区在线| 91精品国产欧美一区二区| 亚洲欧洲色图综合| 国产一区二区不卡在线 | 日韩免费一区二区三区在线播放| 综合色天天鬼久久鬼色| 黑人巨大精品欧美黑白配亚洲 | 久久精品在这里| 日韩精品欧美成人高清一区二区| 99精品视频中文字幕| 欧美成人激情免费网| 亚洲国产一区在线观看| 成人av免费观看| 久久久.com| 精品一区二区三区久久| 欧美理论片在线| 一区二区三区在线视频免费| 成人精品国产免费网站| 久久久一区二区三区| 免费成人在线网站| 欧美乱妇一区二区三区不卡视频| 日韩理论电影院| 成人黄色电影在线| 国产人伦精品一区二区| 国产在线一区观看| 日韩欧美激情在线| 另类专区欧美蜜桃臀第一页| 欧美一区二区三区免费观看视频| 亚洲国产成人tv| 欧美体内she精高潮| 夜夜亚洲天天久久| 色婷婷av一区| 亚洲激情自拍视频| 91九色最新地址| 亚洲尤物在线视频观看| 色综合久久精品| 亚洲免费观看在线视频| 色综合色综合色综合| 亚洲欧美福利一区二区| 色哟哟在线观看一区二区三区| 国产精品免费久久| 99精品视频免费在线观看| 国产精品全国免费观看高清| 豆国产96在线|亚洲| 欧美国产精品专区| eeuss鲁片一区二区三区| 亚洲色图视频网| 色婷婷精品大视频在线蜜桃视频 | 亚洲伊人色欲综合网| 欧美无乱码久久久免费午夜一区| 亚洲一区二区三区视频在线 | 精品久久一二三区| 国产精品综合在线视频| 欧美激情一区二区三区在线| 成人一区在线看| 亚洲日本一区二区| 欧美日韩午夜在线视频| 麻豆精品视频在线观看| 国产女同互慰高潮91漫画| 99国产精品久久久久久久久久久| 亚洲伦理在线免费看| 欧美另类变人与禽xxxxx| 久草中文综合在线| 国产精品天干天干在线综合| 色国产精品一区在线观看| 午夜电影一区二区三区| 久久久美女艺术照精彩视频福利播放| 国产精品一区二区果冻传媒| 亚洲色图在线播放| 91精品婷婷国产综合久久性色| 激情综合色丁香一区二区| 国产精品麻豆一区二区| 欧美日韩精品一区二区三区| 精品亚洲porn| 亚洲品质自拍视频| 欧美一区二区三区播放老司机| 国产激情一区二区三区四区| 一区二区三区免费在线观看| 日韩欧美综合一区| 99久久99久久精品免费看蜜桃| 日韩高清在线观看| 中文字幕精品一区二区精品绿巨人| 91电影在线观看| 极品尤物av久久免费看| 亚洲免费观看高清在线观看| 日韩欧美美女一区二区三区| 色综合激情久久| 狠狠色伊人亚洲综合成人| 亚洲精品少妇30p| 久久综合资源网| 欧美在线不卡一区| 国产精品夜夜嗨| 亚洲综合激情网| 国产精品色一区二区三区| 91麻豆精品国产自产在线| av在线一区二区三区| 久久99精品久久久久久久久久久久 | 看国产成人h片视频| 亚洲欧洲av一区二区三区久久| 日韩欧美黄色影院| 欧美视频完全免费看| 成人av电影观看| 激情综合色播五月| 日韩国产精品91|